Exemplo n.º 1
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 (Helper.IsWindows8OrGreater)
            {
                reSortie.Readied += (sender, args) =>
                {
                    if (this.IsNotifyReadied)
                    {
                        Toast.Show(
                            "疲労回復完了",
                            "「" + parent.Name + "」の全艦娘の疲労が回復しました。",
                            () => App.ViewModelRoot.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();
        }
        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(
                            "疲労回復完了",
                            "「" + parent.Name + "」の全艦娘の疲労が回復しました。",
                            () => App.ViewModelRoot.Activate());
                    }
                };
            }
            else
            {
                reSortie.Readied += (sender, args) =>
                {
                    if (this.IsNotifyReadied)
                    {
                        NotifyIconWrapper.Show(
                            "疲労回復完了",
                            "「" + parent.Name + "」の全艦娘の疲労が回復しました。");
                    }
                };
            }
        }
        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());
                }
            };
        }