public ReSortieBarViewModel(FleetViewModel parent, FleetReSortie reSortie)
        {
            this.source = reSortie;
            this.CompositeDisposable.Add(new PropertyChangedEventListener(reSortie)
            {
                { () => reSortie.Reason, (sender, args) => this.UpdateMessage() },
                { () => reSortie.Remaining, (sender, args) => this.UpdateRemaining() },
            });

            this.UpdateMessage();
            this.UpdateRemaining();

            if (Helper.IsWindows8OrGreater)
            {
                reSortie.Readied += (sender, args) =>
                {
                    if (this.IsNotifyReadied)
                    {
                        Toast.Show(
                            "疲労回復完了",
                            "「" + parent.Name + "」の全艦娘の疲労が回復しました。",
                            () => this.Messenger.Raise(new WindowActionMessage(WindowAction.Active, "Window/Activate")));
                    }
                };
            }
        }
        public ReSortieBarViewModel(FleetViewModel parent, FleetReSortie reSortie)
        {
            this.source = reSortie;
            this.CompositeDisposable.Add(new PropertyChangedEventListener(reSortie)
            {
                { () => reSortie.Reason, (sender, args) => this.UpdateMessage() },
                { () => reSortie.Remaining, (sender, args) => this.UpdateRemaining() },
            });

            reSortie.Readied += (sender, args) =>
            {
                if (Models.Settings.Current.EnableFatigueNotification)
                {
                    WindowsNotification.Notifier.Show(
                        Resources.ReSortie_NotificationMessage_Title,
                        string.Format(Resources.ReSortie_NotificationMessage, parent.Name),
                        () => App.ViewModelRoot.Activate());
                }
            };

            reSortie.CriticalCondition += (sender, args) =>
            {
                if (Models.Settings.Current.EnableCriticalNotify)
                {
                    WindowsNotification.Notifier.Show(
                        Resources.ReSortie_CriticalConditionMessage_Title,
                        string.Format(Resources.ReSortie_CriticalConditionMessage, args.Ship.Info.Name, parent.Name),
                        () => App.ViewModelRoot.Activate());
                }

                if (Models.Settings.Current.EnableCriticalAccent)
                {
                    App.ViewModelRoot.Mode = Mode.CriticalCondition;
                }
            };

            reSortie.CriticalCleared += (sender, args) =>
            {
                App.ViewModelRoot.Mode = Mode.Started;
            };

            this.UpdateMessage();
            this.UpdateRemaining();
        }
Esempio n. 3
0
        public ReSortieBarViewModel(FleetViewModel parent, FleetReSortie reSortie)
        {
            this.source = reSortie;
            this.CompositeDisposable.Add(new PropertyChangedEventListener(reSortie)
            {
                { () => reSortie.Reason, (sender, args) => this.UpdateMessage() },
                { () => reSortie.Remaining, (sender, args) => this.UpdateRemaining() },
            });

            this.UpdateMessage();
            this.UpdateRemaining();

            if (Toast.IsSupported)
            {
                reSortie.Readied += (sender, args) =>
                {
                    if (this.IsNotifyReadied)
                    {
                        Toast.Show(
                            "Morale Recovery",
                            "Morale of ships in the " + parent.Name + "has fully recovered.",
                            () => App.ViewModelRoot.Activate());
                    }
                };
            }
            else
            {
                reSortie.Readied += (sender, args) =>
                {
                    if (this.IsNotifyReadied)
                    {
                        NotifyIconWrapper.Show(
                            "Morale Recovery",
                            "Morale of ships in the " + parent.Name + "has fully recovered.");
                    }
                };
            }
        }
Esempio n. 4
0
        public ReSortieBarViewModel(FleetViewModel parent, FleetReSortie reSortie)
        {
            this.source = reSortie;
            this.CompositeDisposable.Add(new PropertyChangedEventListener(reSortie)
            {
                { () => reSortie.Reason, (sender, args) => this.UpdateMessage() },
                { () => reSortie.Remaining, (sender, args) => this.UpdateRemaining() },
            });

            this.UpdateMessage();
            this.UpdateRemaining();

            reSortie.Readied += (sender, args) =>
            {
                if (this.IsNotifyReadied)
                {
                    WindowsNotification.Notifier.Show(
                        Resources.ReSortie_NotificationMessage_Title,
                        string.Format(Resources.ReSortie_NotificationMessage, parent.Name),
                        () => App.ViewModelRoot.Activate());
                }
            };
        }