private void Contractor_CommandReceived(object sender, InvokedEventArgs e) { try { switch (e.Command) { case "Construct": { ICClearBtn_Click(this, e); ICHeaderTxt.Text = e.Args[0].ToString(); if (e.Args.Length < 2) { return; } ICConstructerLstvw.BeginUpdate(); for (int i = 1; i < e.Args.Length; i++) { ICConstructerLstvw.Append(e.Args[i]); } ICConstructerLstvw.EndUpdate(); break; } } e.Result = true; } catch { e.Result = false; } }
private void ICAppendBtn_Click(object sender, EventArgs e) { object value = null; int count = (int)ICCountTxt.Value; switch (((Control)sender).Text.Split(' ')[1]) { case "String": value = ICValueTxt.Text; break; case "Integer": { int outcome = 0; int.TryParse(ICValueTxt.Text, out outcome); value = outcome; break; } case "Boolean": { if (string.IsNullOrWhiteSpace(ICValueTxt.Text)) { value = false; } else { char start = ICValueTxt.Text[0]; value = (start == 't' || start == '1'); } break; } } var values = new object[count]; for (int i = 0; i < values.Length; i++) { values[i] = value; } ICConstructerLstvw.Append(values); ICChunkCountLbl.Text = string.Format(CHUNK_COUNT_FORMAT, ICConstructerLstvw.ChunksWritten.Count); }