void Awake() { model = gameObject.GetComponent<ToolTipViewModel>(); if (null == model) { throw new MissingComponentException(); } }
void Awake() { model = gameObject.GetComponent <ToolTipViewModel>(); if (null == model) { throw new MissingComponentException(); } }
private void Update() { OnPropertyChanged(() => TimeSpent); OnPropertyChanged(() => Project); OnPropertyChanged(() => StartedText); OnPropertyChanged(() => IsStopped); OnPropertyChanged(() => IsRunning); OnPropertyChanged(() => IsSaved); OnPropertyChanged(() => TaskName); ToolTipViewModel.Update(TimeEntry); OnPropertyChanged(() => ToolTipViewModel); }
private void _timeEntryTimerService_TimeEntryUpdated(object sender, EventArgs e) { OnPropertyChanged(() => TimeSpent); OnPropertyChanged(() => StartedText); OnPropertyChanged(() => IsStopped); OnPropertyChanged(() => IsRunning); if (IsStopped) { Update(); } ToolTipViewModel.Update(TimeEntry); OnPropertyChanged(() => ToolTipViewModel); }
private void InitializeTimer(TimeEntry timeEntry) { //if the given is null, create a new timer based on the existing timeentry (with same task and project) if (timeEntry == null) { TimeEntry = TimeEntry.Create(TimeEntry); } //If time is zero, start a new timer based on the given timeentry (with same task and project) else if (timeEntry.TimeSpent == TimeSpan.Zero) { TimeEntry = TimeEntry.Create(timeEntry); } //Else just continue the timer on the current timeentry else { TimeEntry = timeEntry; } if (TimerService != null) { TimerService.Dispose(); TimerService = null; } if (ToolTipViewModel == null) { ToolTipViewModel = new TaskToolTipViewModel(TimeEntry); } else { ToolTipViewModel.Update(TimeEntry); } _applicationStateService.CurrentState.ActiveTimeEntry = TimeEntry; _applicationStateService.Save(); TimerService = new TimeEntryTimerService(TimeEntry); TimerService.TimeEntryUpdated += _timeEntryTimerService_TimeEntryUpdated; TimerService.TimerStateChanged += _timeEntryTimerService_TimerStateChanged; }
private IDisposable BindToToolTip(ToolTipViewModel x, IWin32Window window) { CompositeDisposable toolTipDisposable = new CompositeDisposable(); ToolTip toolTip = new ToolTip(); x.Title .Subscribe(y => toolTip.ToolTipTitle = y) .AddTo(toolTipDisposable); x.Icon .Subscribe(y => toolTip.ToolTipIcon = (ToolTipIcon)(int)y) .AddTo(toolTipDisposable); x.IsOpen .Subscribe(y => { if (y) { toolTip.Show(x.Text.Value, window, (int)x.X.Value, (int)x.Y.Value); } else { toolTip.Hide(window); } }) .AddTo(toolTipDisposable); x.Text .Subscribe(y => { if (x.IsOpen.Value) { toolTip.Hide(window); toolTip.Show(y, window, (int)x.X.Value, (int)x.Y.Value); } }) .AddTo(toolTipDisposable); x.X.Subscribe(y => { if (x.IsOpen.Value) { toolTip.Hide(window); toolTip.Show(x.Text.Value, window, (int)y, (int)x.Y.Value); } }) .AddTo(toolTipDisposable); x.Y.Subscribe(y => { if (x.IsOpen.Value) { toolTip.Hide(window); toolTip.Show(x.Text.Value, window, (int)x.X.Value, (int)y); } }) .AddTo(toolTipDisposable); return(toolTipDisposable); }