void UpdateMappedUserSettings() { lock (DevicesToMapDataGridViewLock) { // If list not linked to any controller then return. if (_MappedTo == MapTo.None) { return; } var grid = MainDataGrid; var game = SettingsManager.CurrentGame; // Get rows which must be displayed on the list. var itemsToShow = SettingsManager.UserSettings.ItemsToArraySynchronized() // Filter devices by controller. .Where(x => x.MapTo == (int)_MappedTo) // Filter devices by selected game (no items will be shown if game is not selected). .Where(x => game != null && x.FileName == game.FileName && x.FileProductName == game.FileProductName) .ToList(); var itemsToRemove = mappedUserSettings.Except(itemsToShow).ToArray(); var itemsToInsert = itemsToShow.Except(mappedUserSettings).ToArray(); // If columns will be hidden or shown then... if (itemsToRemove.Length > 0 || itemsToInsert.Length > 0) { // Do removal. foreach (var item in itemsToRemove) { mappedUserSettings.Remove(item); } // Do adding. foreach (var item in itemsToInsert) { mappedUserSettings.Add(item); } } var itemToSelect = itemsToInsert.FirstOrDefault(); // If item was inserted and not selected then... if (itemToSelect != null && !grid.SelectedItems.Contains(itemToSelect)) { if (grid.SelectionMode == DataGridSelectionMode.Single) { grid.SelectedItem = itemToSelect; } else { // Clear current selection. grid.SelectedItems.Clear(); // Select new item. grid.SelectedItems.Add(itemToSelect); } } var visibleCount = mappedUserSettings.Count(); var title = string.Format("Enable {0} Mapped Device{1}", visibleCount, visibleCount == 1 ? "" : "s"); if (mappedUserSettings.Count(x => x.IsEnabled) > 1) { title += " (Combine)"; } ControlsHelper.SetText(EnabledLabel, title); } }
//ユーザー登録 private void button2_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(textBox2.Text)) { return; } var ttt = User.GetUserNo(textBox2.Text); if (string.IsNullOrEmpty(ttt)) { AddLog("正しいユーザーを登録してください。", 3); return; } if (lists_u.Count(x => x.UserId == ttt) > 0) { AddLog("そのユーザーは登録済です。", 3); return; } //ユーザーの存在チェック、ユーザー名をゲット //ユーザーを登録 var user = new User(); user.Clear(); user.UserId = ttt; user.Regist_Date = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"); lists_u.Add(user); textBox2.Text = ""; }
void UpdateMappedUserSettings() { lock (DevicesToMapDataGridViewLock) { var grid = MainDataGrid; var game = SettingsManager.CurrentGame; // Get rows which must be displayed on the list. var itemsToShow = SettingsManager.UserSettings.ItemsToArraySyncronized() // Filter devices by controller. .Where(x => x.MapTo == (int)_MappedTo) // Filter devices by selected game (no items will be shown if game is not selected). .Where(x => game != null && x.FileName == game.FileName && x.FileProductName == game.FileProductName) .ToList(); var itemsToRemove = mappedUserSettings.Except(itemsToShow).ToArray(); var itemsToInsert = itemsToShow.Except(mappedUserSettings).ToArray(); // If columns will be hidden or shown then... if (itemsToRemove.Length > 0 || itemsToInsert.Length > 0) { // Do removal. foreach (var item in itemsToRemove) { mappedUserSettings.Remove(item); } // Do adding. foreach (var item in itemsToInsert) { mappedUserSettings.Add(item); } } foreach (var item in itemsToInsert) { grid.SelectedItems.Add(item); } var visibleCount = mappedUserSettings.Count(); var title = string.Format("Enable {0} Mapped Device{1}", visibleCount, visibleCount == 1 ? "" : "s"); if (mappedUserSettings.Count(x => x.IsEnabled) > 1) { title += " (Combine)"; } ControlsHelper.SetText(EnabledLabel, title); } }
//コミュ登録 private async void button1_Click_1(object sender, EventArgs e) { if (string.IsNullOrEmpty(textBox1.Text)) { return; } var ttt = Comm.GetChNo(textBox1.Text); if (string.IsNullOrEmpty(ttt)) { AddLog("正しいコミュを登録してください。", 3); return; } if (lists_c.Count(x => x.ComId == ttt) > 0) { AddLog("そのコミュは登録済です。", 3); return; } //コミュの存在チェック、コミュ名をゲット string ttt2; using (var nnn = new NicoLiveNet()) { if (ttt.IndexOf("co") > -1) { ttt2 = await nnn.GetCommNameAsync(ttt); } else { ttt2 = await nnn.GetChNameAsync(ttt); } } if (string.IsNullOrEmpty(ttt2)) { AddLog("そのコミュは存在しません。", 3); return; } //コミュを登録 var comm = new Comm(); comm.Clear(); comm.ComId = ttt; comm.ComName = ttt2; comm.Regist_Date = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"); lists_c.Add(comm); textBox1.Text = ""; }
private void InitialSystemInfo() { if (readCards == null) { readCards = new List <cls_order_info>(); } this.gvList.AutoGenerateColumns = false; sortablePendingOrderList = new SortableBindingList <cls_order_info>(readCards); this.gvList.DataSource = sortablePendingOrderList; gvList.DataKeyNames = new string[] { "Order_id" };//主键 this.gvList.DataBind(); Show_infomation = "共计 " + sortablePendingOrderList.Count() + " 条"; }
private void InitialSystemInfo() { if (KEYResult == null) { KEYResult = new List <clt_POS_info>(); } this.gvList.AutoGenerateColumns = false; sortablePendingOrderList = new SortableBindingList <clt_POS_info>(KEYResult); this.gvList.DataSource = sortablePendingOrderList; gvList.DataKeyNames = new string[] { "Order_id" };//主键 this.gvList.DataBind(); alterinfo = "共计 " + sortablePendingOrderList.Count() + " 条"; }