public static bool AddTeamMember(CheckedListViewItemCollection mems, string guid) { var info = ChatList.FirstOrDefault(d => d.ChatUserName == guid && d.ChatType == ChatType.TeamChat); if (info == null) { ShowError("未找到添加的分组信息"); return(false); } string userName = ""; string displayName = ""; foreach (ListViewItem item in mems) { userName = item.SubItems[1].Text; displayName = item.Text; if (!info.TeamMembers.Any(d => d.UserName == userName)) { info.TeamMembers.Add(new TeamMember { UserName = userName, DisplayName = displayName, IsOnline = true }); } } IsTeamChatChanged = true; // ShowSuccess("分组成员添加成功"); return(true); }
public BaseListGrid() : base() { Items = new ListGridItemCollection(this); Columns = new ListGridColumnHeaderCollection(this); SelectedItems = new SelectedListViewItemCollection(this); CheckedItems = new CheckedListViewItemCollection(this); }
public ListGrid() : base() { Items = new ListGridItemCollection(this); Columns = new ListGridColumnHeaderCollection(this); //SelectedItems = new SelectedListViewItemCollection(this); CheckedItems = new CheckedListViewItemCollection(this); _DataGridColumns = new Dictionary <string, DataGridColumn>(); }
private void btnSendUpdate_Click(object sender, EventArgs e) { string parkingCode = Convert.ToString(this.cbParking.SelectedValue); if (string.IsNullOrEmpty(parkingCode)) { MessageBox.Show("请先选择停车场", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } CheckedListViewItemCollection checkedItem = this.listCamera.CheckedItems; if (checkedItem == null || checkedItem.Count <= 0) { MessageBox.Show("请选择需要更新的相机", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } string inputUrl = this.txtUpdateUrl.Text; string inputMd5 = this.txtUpdateMd5.Text; string inputVersion = this.txtVersion.Text; if (string.IsNullOrEmpty(inputUrl) || string.IsNullOrEmpty(inputMd5) || string.IsNullOrEmpty(inputVersion)) { MessageBox.Show("请将更新信息填写完整", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } DialogResult tipResult = MessageBox.Show("请仔细核对更新内容?\n该操作可能导致现场相机无法正常使用", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (tipResult != DialogResult.OK) { return; } CameraUpdateModel updateModel = new CameraUpdateModel(); updateModel.UpdateUrl = inputUrl; updateModel.UpdateMd5 = inputMd5; updateModel.UpdateVersion = inputVersion; foreach (ListViewItem item in checkedItem) { string macAddress = item.SubItems["deviceMacAddress"].Text; if (string.IsNullOrEmpty(macAddress)) { continue; } updateModel.DeviceIdentify = macAddress; CarNumberRepushToCamera(updateModel, parkingCode); } //暂不参考mq返回结果 MessageBox.Show("更新命令发送成功", "提示", MessageBoxButtons.OK); }
public ListView () { background_color = Color.White;//ThemeEngine.Current.ColorWindow; groups = new ListViewGroupCollection (this); items = new ListViewItemCollection (this); items.Changed += new CollectionChangedHandler (OnItemsChanged); checked_indices = new CheckedIndexCollection (this); checked_items = new CheckedListViewItemCollection (this); columns = new ColumnHeaderCollection (this); foreground_color = SystemColors.WindowText; selected_indices = new SelectedIndexCollection (this); selected_items = new SelectedListViewItemCollection (this); items_location = new Point [16]; items_matrix_location = new ItemMatrixLocation [16]; reordered_items_indices = new int [16]; item_tooltip = new ToolTip (); item_tooltip.Active = false; insertion_mark = new ListViewInsertionMark (this); InternalBorderStyle = BorderStyle.Fixed3D; header_control = new HeaderControl (this); header_control.Visible = false; Controls.AddImplicit (header_control); item_control = new ItemControl (this); Controls.AddImplicit (item_control); h_marker = v_marker = 0; keysearch_tickcnt = 0; // scroll bars are disabled initially h_scroll.Visible = false; //h_scroll.ValueChanged += new EventHandler(HorizontalScroller); v_scroll.Visible = false; //v_scroll.ValueChanged += new EventHandler(VerticalScroller); // event handlers base.KeyDown += new KeyEventHandler(ListView_KeyDown); SizeChanged += new EventHandler (ListView_SizeChanged); //GotFocus += new EventHandler (FocusChanged); //LostFocus += new EventHandler (FocusChanged); //MouseWheel += new MouseEventHandler(ListView_MouseWheel); //MouseEnter += new EventHandler (ListView_MouseEnter); Invalidated += new InvalidateEventHandler (ListView_Invalidated); BackgroundImageTiled = false; this.SetStyle (ControlStyles.UserPaint | ControlStyles.StandardClick | ControlStyles.UseTextForAccessibility , false); }
private void createTestsBtn_Click(object sender, EventArgs e) { //конфигурация Configuration configuration = Configuration.getInstance(); //выбор xlsx выбраных dll Dictionary <Assembly, ListViewItem[]> selectedDllToXlsx = new Dictionary <Assembly, ListViewItem[]>(); CheckedListViewItemCollection checkedItems = this.dllView.CheckedItems; bool allHasChecked = false; if (checkedItems.Count == 0) { MessageBox.Show("Не выбрано ни одного теста"); } else { foreach (ListViewItem item in checkedItems) { Assembly dll = resultAssemblies.Single(a => a.GetName().Name == item.Text); List <ListViewItem> xlsx = dllToXlsx[dll.GetName().Name].ToList(); List <ListViewItem> selectedXlsx = new List <ListViewItem>(); bool hasChecked = false; foreach (ListViewItem item1 in xlsx) { if (item1.Checked) { hasChecked = true; allHasChecked = allHasChecked || hasChecked; selectedXlsx.Add(item1); } } if (!hasChecked) { allHasChecked = allHasChecked && hasChecked; MessageBox.Show(String.Format("Не выбрано ни одного тестового файла для {0}", dll.GetName().Name)); } selectedDllToXlsx.Add(dll, selectedXlsx.ToArray()); //пишем конфигурацию TestConfigurationView tcv = dllToConfig[dll.GetName().Name]; JObject testConfig = tcv.Config; JArray data = new JArray(); for (int i = 0; i < selectedXlsx.Count; i++) { data.Add(selectedXlsx[i].Text); } testConfig["data"] = data; JObject json = configuration.Config; json[dll.GetName().Name] = testConfig; } if (allHasChecked) { configuration.write(); //модальное окно создания тестов List <Test> tests = new List <Test>(); CreatingTestsModalForm modal = new CreatingTestsModalForm(selectedDllToXlsx, tests, configuration.Config); modal.Owner = this; DialogResult result = modal.ShowDialog(); if (result == DialogResult.OK) { SelectTestsToRunForm form = new SelectTestsToRunForm(tests, this); this.Hide(); form.Show(); } } } }