internal void ShowForm(ClockM cd) { if (MyForms.ContainsKey(cd)) { return; } MyMainWindow.VM.MultiAudioPlayer.AddClockData(cd); MyMainWindow.VM.MultiAudioPlayer.PlaySound(); var MyTimeOutForm = new TimeOutWindow() { Clock = cd }; MyTimeOutForm.IsVisibleChanged += TimeOutForm_VisibleChanged; MyTimeOutForm.Show(); MyTimeOutForm.Activate(); MyForms[cd] = MyTimeOutForm; }
internal void CloseForm(ClockM cd) { if (MyForms.ContainsKey(cd)) { MyForms[cd].Close(); // TODO: bug here when window is already in the process of closing MyForms.Remove(cd); } }
internal ClockVM VMForM(ClockM td) { if (MToVM.ContainsKey(td)) { return(MToVM[td]); } return(null); }
public void HideForm(ClockM cd) { TimeOutWindow f = MyForms[cd]; if (f != null) { f.Hide(); } }
public ClockVM(ClockM model, ClockVMCollection coll) { Collection = coll; Model = model; Model.PropertyChanged += Model_PropertyChanged; Collection.SubscribeToClock(this); MyToggleCommand = new RelayCommand(OnToggle); MyDeleteCommand = new RelayCommand(OnDelete); }
/// <summary> /// Also adds the group of the ClockData to the Groups collection. /// </summary> /// <param name="td"></param> internal void AddClock(ClockM td) { if (Contains(td)) { return; } AddClockUnchecked(td); ++VisibleCount; IsUnsaved = true; OnClockAdded(new ClockEventArgs() { Clock = td }); DoAllNeededSorts(); }
/// <summary> /// Requires f (the filter) to not be null. /// </summary> /// <param name="f"></param> /// <param name="td"></param> /// <returns></returns> internal static bool ClockSatisfiesFilter(FilterM f, ClockM td) { bool r = false; if (!f.ShowActive || !f.ShowInactive) { if (f.ShowActive) { if (td is AlarmData ad && !ad.Enabled) { r = true; } else if (td is TimerData tdd && !tdd.Running) { r = true; } else { //r |= false; } }
internal void HandleClockRemoval(ClockM c) { var td = c as TimerData; if (td == null) { return; } ClockVM vm = MyDataFile.ClockVMCollection.VMForM(td); ClockMenuItem tmi = ExistingClockMenuItemInActiveMenu(vm); if (tmi != null) { //tmi.UpdateImage(); //ToolStrip p = tmi.Owner; //Items.Remove(tmi); //MyInactiveMenuItem.Items.Insert(0, tmi); } UpdateSeparatorsVisibility(); }
private void UpdateClosestRingingMomentClockBasedOnChangedClock(ClockM c) { if (c == null) { ClosestRingingMomentClockVM = null; return; } var vm = VMForM(c); // `vm == null` is when changing (toggling) the same clock's type twice if (vm != null && vm.IsActive && !c.IsBeingDeleted) { if (ClosestRingingMomentClockVM == null) { ClosestRingingMomentClockVM = vm; } else { ClosestRingingMomentClockVM = ClockMin(vm, ClosestRingingMomentClockVM); } } else { if (ClosestRingingMomentClockVM == null) { FullUpdateOfClosestRingingMomentClock(); } else if (ClosestRingingMomentClockVM != null && (!ClosestRingingMomentClockVM.IsActive || c.IsBeingDeleted)) { FullUpdateOfClosestRingingMomentClock(); } } }
internal bool HasClockData(ClockM cd) { return(Times.ContainsKey(cd)); }
internal void AddClockData(ClockM clockData) { Times[clockData] = (int)( ((TimeSpan)MyDataFile.Settings.GetValue("RingingDuration")).TotalSeconds ); }
internal void RemoveClockMAndStopSoundIfNeeded(ClockM tc) { Times.Remove(tc); StopSoundIfNeeded(); }
internal void Insert(int newIndex, ClockM cd) { AddClock(cd); Ms.Move(Ms.Count - 1, newIndex); }
public TimeOutWindowM(ClockM model) { MyClockM = model; }
internal void ChangeTypeOfClock(ClockM cd, Type newType) { Model.PropertyChanged -= Model_PropertyChanged; if (newType == typeof(TimerData)) { if (cd.IsActive) { cd.ActivateOrDeactivate(); } var tdata = new TimerData(Model.MyDataFile, Model.MyDataFile.MultiAudioPlayer); tdata.GroupName = cd.GroupName; tdata.Icon = cd.Icon; tdata.Style = cd.Style; tdata.UserBackColor = cd.UserBackColor; tdata.Tag = cd.Tag; tdata.IsUnsaved = true; tdata.ID = cd.ID; tdata.Checkable = cd.Checkable; tdata.Checked = cd.Checked; Model = tdata; } else // AlarmData { if (cd.IsActive) { cd.ActivateOrDeactivate(); } var adata = new AlarmData(Model.MyDataFile, Model.MyDataFile.MultiAudioPlayer); adata.GroupName = cd.GroupName; adata.Icon = cd.Icon; adata.Style = cd.Style; adata.UserBackColor = cd.UserBackColor; adata.Tag = cd.Tag; adata.IsUnsaved = true; adata.ID = cd.ID; adata.Checkable = cd.Checkable; adata.Checked = cd.Checked; Model = adata; } Model.PropertyChanged += Model_PropertyChanged; RaisePropertyChanged("CurrentValue"); RaisePropertyChanged("ResetToValue"); RaisePropertyChanged("IsActive"); RaisePropertyChanged("IsUnsaved"); ClockTypeChanged?.Invoke(this, new ClockTypeChangedEventArgs() { ClockVM = this, NewClockM = Model, OldClockM = cd }); IsUnsaved = true; }
internal PropertyChangedClockEventArgs(string propertyName, ClockM c) : base(propertyName) { Clock = c; }
internal bool Contains(ClockM cd) { return(Utils.ContainsReference(Ms, cd)); }
public ClockEventArgs(ClockM c = null, int i = -1) { Clock = c; Index = i; }
public ClockMovedEventArgs(ClockM c = null, int o = -1, int n = -1) { Clock = c; OldIndex = o; NewIndex = n; }