private void SetIcon_Click(object sender, RoutedEventArgs e) { System.Windows.Forms.OpenFileDialog ofd = Utils.GetImageChooser(); if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { var ico = new System.Drawing.Bitmap(ofd.FileName); for (int i = MyListView.SelectedItems.Count - 1; i >= 0; --i) { var fd = MyListView.SelectedItems[i] as FilterVM; ClockGroupMCollection x = MyDataFile.ClockVMCollection.Model.Groups; // DisplayString equivalent to Name for filters which have a context // menu: x.Ms[x.Ms.IndexOf(cgm => cgm.Name == fd.DisplayString)].Icon = Utils.GetBitmapImageFromBitmap(ico); ReloadGroups(); } ico.Dispose(); } }
public ClockGroupVMCollection(ClockMCollection cdc) { MyClockDataCollection = cdc; MyModel = new ClockGroupMCollection(MyClockDataCollection); MyModel.Ms.CollectionChanged += MyModel_CollectionChanged; VMs = new ObservableCollection <ClockGroupVM>(); VMs.CollectionChanged += VMs_CollectionChanged; }
private void RemoveIcon_Click(object sender, RoutedEventArgs e) { for (int i = MyListView.SelectedItems.Count - 1; i >= 0; --i) { var fd = MyListView.SelectedItems[i] as FilterVM; ClockGroupMCollection x = MyDataFile.ClockVMCollection.Model.Groups; // DisplayString equivalent to Name for filters which have a context // menu: x.Ms[x.IndexOf(fd.DisplayString)].Icon = null; ReloadGroups(); } }
internal FilterM(ClockMCollection cdc, string s = "") { Clocks = cdc; Groups = Clocks.Groups; List <string> l = s.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList(); if (l.Contains("active")) { ShowActive = true; ShowInactive = false; l.RemoveAll(x => x == "active"); } if (l.Contains("timers")) { ShowTimers = true; ShowAlarms = false; l.RemoveAll(x => x == "timers"); } if (l.Contains("inactive")) { ShowActive = false; ShowInactive = true; l.RemoveAll(x => x == "inactive"); } if (l.Contains("alarms")) { ShowTimers = false; ShowAlarms = true; l.RemoveAll(x => x == "alarms"); } foreach (string str in l) { if (string.IsNullOrWhiteSpace(str)) { continue; } try { int x = Convert.ToInt32(str); if (1 <= x && x <= Groups.Ms.Count) { //GroupIndices.Add(x); GroupNames.Add(Groups.Ms[x - 1].Name); } else { Autocorrected = true; } } catch (FormatException /*ex*/) { SearchString += str; continue; } } SearchString = SearchString.Trim(); }