private void Model_ClockRemoved(object sender, ClockEventArgs e)
        {
            var td = e.Clock as TimerData;

            if (td == null)
            {
                return;
            }

            ClockVM vm = MyDataFile.ClockVMCollection.VMForM(td);

            bool          active = true;
            ClockMenuItem tmi    = ExistingClockMenuItemInActiveMenu(vm);

            if (tmi == null)
            {
                active = false;
                //tmi = ExistingClockMenuItemInInactiveMenu(vm);
            }
            if (tmi != null)
            {
                if (active)
                {
                    Items.Remove(tmi);
                }
                else
                {
                    //MyInactiveMenuItem.Items.Remove(tmi);
                }
            }

            UpdateSeparatorsVisibility();
        }
Пример #2
0
        private void OnClockAdded(ClockEventArgs e)
        {
            SubscribeToClock(e.Clock);

            // before sorting...
            //CollectionChanged?.Invoke(this,
            //    new NotifyCollectionChangedEventArgs(
            //        NotifyCollectionChangedAction.Add, e.Clock));

            // this sorts sometimes...
            ClockAdded?.Invoke(this, e);
        }
        private void Model_TimerStartedByUser(object sender, ClockEventArgs e)
        {
            //var td = e.Clock as TimerData;
            //if (td == null)
            //{
            //    return;
            //}

            //ClockVM vm = MyDataFile.ClockVMCollection.VMForM(td);

            //ClockMenuItem cmi = ExistingClockMenuItemInInactiveMenu(vm);
            //if (cmi != null)
            //{
            //    MyInactiveMenuItem.Items.Remove(cmi);
            //    Items.Insert(0, cmi); // TODO: [VISUAL] insert at correct position according to the order in the MainForm
            //}

            UpdateSeparatorsVisibility();
        }
        private void Model_ClockAdded(object sender, ClockEventArgs e)
        {
            if (e.Clock is TimerData tdd)
            {
                ClockVM vm = MyDataFile.ClockVMCollection.VMForM(tdd);

                var tmi = new ClockMenuItem();
                tmi.DataContext = vm;
                if (tdd.Running)
                {
                    AddTimerMenuItemToMainMenu(tmi);
                }
                else
                {
                    AddTimerMenuItemToMainMenu(tmi);
                    //MyInactiveMenuItem.Items.Insert(0, tmi);
                }
            }

            UpdateSeparatorsVisibility();
        }
Пример #5
0
 private void Td_TimerStopped(object sender, ClockEventArgs e)
 {
     new TimeOutWindowVM(
         new TimeOutWindowM(e.Clock)).ShowWindow();
 }
Пример #6
0
 private void Model_ClockAdded(object sender, ClockEventArgs e)
 {
     UpdateClosestRingingMomentClockBasedOnChangedClock(e.Clock);
 }
Пример #7
0
 private void Model_TimerStartedByUser(object sender, ClockEventArgs e)
 {
     //UpdateClosestRingingMomentClockBasedOnChangedClock(e.Clock);
 }
 private void Model_TimerStopped(object sender, ClockEventArgs e)
 {
     HandleClockRemoval(e.Clock);
 }