मैं एक ग्रिड है कि मैं कोशिश कर रहा हूँ करने के लिए किसी आइटम को हटाने में विशिष्ट लाइन है । यह एक पाश में, तो जब यह हो जाता है, दूसरी पंक्ति के लिए, इसे हटा मद में दूसरी पंक्ति और यह भी पहली पंक्ति में. कैसे मैं समायोजित कर सकते हैं दूर करने के लिए ही लाइन है कि मैं करना चाहते हैं?
ध्यान दें कि मैं क्या कर रहा हूँ करने की कोशिश कर रहा है, नकल करने के लिए पहली पंक्ति के दूसरे ही हल पाउ (बी 2), और तीसरी पंक्ति में मैं नकल करेंगे दूसरी लाइन है, लेकिन हल -4 * 5 (-4 * एक).
इस का पूर्वावलोकन है क्या हो रहा है.
यह है मेरे कोड के लिए फुलाना इन पंक्तियों को समझने के लिए:
यह पहली बार में में प्रवेश करती है if(fields == null)
क्योंकि पाउ है, के बाद कि, के लिए चला जाता है else
:
for (int i = 0; i < qntLines; i++)
{
string field = lines[i].Substring(0, lines[i].IndexOf('#'));
string operation = lines[i].Substring(lines[i].IndexOf('#') + "#".Length);
CreateResultLine(field, operation, i, listTexts);
}
private void CreateResultLine(string field, string operation, int i, List<string> listTexts)
{
string[] fields = null;
List<string> texts = new List<string>();
string text = string.Empty;
dynamic textResult;
int count = new int();
if (field.Contains(','))
fields = field.Split(',', (char)StringSplitOptions.RemoveEmptyEntries);
if (fields == null)
{
text = listTexts[int.Parse(field)];
text = RemovePow(text);
texts.Add(text);
textResult = ExecuteOperation(texts, operation);
gridFrame.Children.RemoveAt(int.Parse(field) + 1);
gridFrame.Children.Add(new Label() { Text = textResult.ToString(), HorizontalTextAlignment = TextAlignment.Center,
TextColor = Color.Blue, HorizontalOptions = LayoutOptions.Center }, int.Parse(field) + 1, i);
}
else
{
foreach (var item in fields)
{
string noPow = string.Empty;
noPow = RemovePow(listTexts[int.Parse(item)]);
texts.Add(noPow);
++count;
}
textResult = ExecuteOperation(texts, operation);
for (int i2 = int.Parse(fields[0]); i2 <= int.Parse(fields[1]);)
{
gridFrame.Children.RemoveAt(int.Parse(fields[0]));
++i2;
}
gridFrame.Children.Add(new Label() { Text = textResult.ToString(), HorizontalTextAlignment = TextAlignment.Center,
TextColor = Color.Blue, HorizontalOptions = LayoutOptions.Center }, int.Parse(fields[0]) + 1, i);
}
}