示例#1
0
        internal MainWindowViewModel()
        {
            GameInformation = new GameInformationViewModel(this);
            r_Page          = GameInformation;

            ApiService.SubscribeOnce("api_start2", delegate
            {
                IsGameStarted = true;
                OnPropertyChanged(nameof(IsGameStarted));
            });

            ApiService.Subscribe("api_req_map/start", _ => ThemeManager.Instance.ChangeAccent(Accent.Brown));
            KanColleGame.Current.ReturnedFromSortie += _ => ThemeManager.Instance.ChangeAccent(Accent.Blue);

            r_BlinkingBrownAccent = new Accent("BlinkingBrown", new Uri("pack://application:,,,/HeavenlyWind;component/Themes/Accents/BlinkingBrown.xaml"));

            PropertyChangedEventListener.FromSource(NotificationService.Instance)
            .Add(nameof(NotificationService.Instance.IsBlinking), delegate
            {
                if (NotificationService.Instance.IsBlinking)
                {
                    ThemeManager.Instance.ChangeAccent(r_BlinkingBrownAccent);
                }
            });

            ShowConstructionHistoryCommand      = new DelegatedCommand(() => WindowService.Instance.Show <ConstructionHistoryWindow>());
            ShowDevelopmentHistoryCommand       = new DelegatedCommand(() => WindowService.Instance.Show <DevelopmentHistoryWindow>());
            ShowSortieHistoryCommand            = new DelegatedCommand(() => WindowService.Instance.Show <SortieHistoryWindow>());
            ShowExpeditionHistoryCommand        = new DelegatedCommand(() => WindowService.Instance.Show <ExpeditionHistoryWindow>());
            ShowScrappingHistoryCommand         = new DelegatedCommand(() => WindowService.Instance.Show <ScrappingHistoryWindow>());
            ShowResourceHistoryCommand          = new DelegatedCommand(() => WindowService.Instance.Show <ResourceHistoryWindow>());
            ShowSortieConsumptionHistoryCommand = new DelegatedCommand(() => WindowService.Instance.Show <SortieConsumptionHistoryWindow>());
            ShowSortieStatisticCommand          = new DelegatedCommand(() => WindowService.Instance.Show <SortieStatisticWindow>());
        }
        public ToolsViewModel(GameInformationViewModel rpOwner)
        {
            r_Owner = rpOwner;

            r_OpenToolPaneCommand = new DelegatedCommand <ToolViewModel>(r_Owner.AddTabItem);
            ToolPanes             = PluginService.Instance.ToolPanes?.Select(r =>
            {
                ToolViewModel rResult;

                var rScrollBarVisibilities = r as IToolPaneScrollBarVisibilities;
                if (rScrollBarVisibilities == null)
                {
                    rResult = new ToolWithoutScrollBarViewModel(r)
                    {
                        OpenCommand = r_OpenToolPaneCommand
                    }
                }
                ;
                else
                {
                    rResult = new ToolWithScrollBarViewModel(r, rScrollBarVisibilities)
                    {
                        OpenCommand = r_OpenToolPaneCommand
                    }
                };

                return(rResult);
            }).ToArray();
        }
        internal MainWindowViewModel()
        {
            Title = ProductInfo.FullAppName;

            var rPropertyChangedSource = Observable.FromEventPattern<PropertyChangedEventArgs>(KanColleGame.Current, nameof(KanColleGame.Current.PropertyChanged))
                .Select(r => r.EventArgs.PropertyName);
            rPropertyChangedSource.Where(r => r == nameof(KanColleGame.Current.IsStarted)).Subscribe(_ => Content = new GameInformationViewModel());
        }
示例#4
0
        public ToolsViewModel(GameInformationViewModel rpOwner)
        {
            r_Owner = rpOwner;

            r_OpenToolPaneCommand = new DelegatedCommand <ToolViewModel>(r_Owner.AddTabItem);
            ToolPanes             = PluginService.Instance.ToolPanes?.Select(r => new ToolViewModel(r)
            {
                OpenCommand = r_OpenToolPaneCommand
            }).ToArray();
        }
        internal MainWindowViewModel()
        {
            r_Page          = new InitializationPageViewModel(this);
            GameInformation = new GameInformationViewModel(this);

            ApiService.SubscribeOnce("api_start2", delegate
            {
                IsGameStarted = true;
                OnPropertyChanged(nameof(IsGameStarted));
            });

            ShowSessionToolCommand = new DelegatedCommand(() => WindowService.Instance.Show <SessionToolWindow>(r_SessionTool));

            ApiService.Subscribe("api_req_map/start", _ => ThemeManager.Instance.ChangeAccent(Accent.Brown));
            KanColleGame.Current.ReturnedFromSortie += _ => ThemeManager.Instance.ChangeAccent(Accent.Blue);

            Preference.Instance.Game.DisableHeavyDamageBlinkingWarning.Subscribe(rpValue =>
            {
                if (SortieInfo.Current == null)
                {
                    return;
                }

                if (!rpValue)
                {
                    ThemeManager.Instance.ChangeAccent(Accent.Brown);
                }
            });

            r_BlinkingBrownAccent = new Accent("BlinkingBrown", new Uri("pack://application:,,,/HeavenlyWind;component/Themes/Accents/BlinkingBrown.xaml"));

            PropertyChangedEventListener.FromSource(NotificationService.Instance)
            .Add(nameof(NotificationService.Instance.IsBlinking), delegate
            {
                if (NotificationService.Instance.IsBlinking)
                {
                    ThemeManager.Instance.ChangeAccent(r_BlinkingBrownAccent);
                }
            });

            UISetZoomCommand = new DelegatedCommand <double>(SetZoom);
            UIZoomInCommand  = new DelegatedCommand(() => SetZoom(Preference.Instance.UI.Zoom.Value + .05));
            UIZoomOutCommand = new DelegatedCommand(() => SetZoom(Preference.Instance.UI.Zoom.Value - .05));

            UIZoomFactors = new[] { .25, .5, .75, 1.0, 1.25, 1.5, 1.75, 2.0, 3.0, 4.0 }.Select(r => new UIZoomInfo(r, UISetZoomCommand)).ToArray();

            ShowConstructionHistoryCommand      = new DelegatedCommand(() => WindowService.Instance.Show <ConstructionHistoryWindow>());
            ShowDevelopmentHistoryCommand       = new DelegatedCommand(() => WindowService.Instance.Show <DevelopmentHistoryWindow>());
            ShowSortieHistoryCommand            = new DelegatedCommand(() => WindowService.Instance.Show <SortieHistoryWindow>());
            ShowExpeditionHistoryCommand        = new DelegatedCommand(() => WindowService.Instance.Show <ExpeditionHistoryWindow>());
            ShowScrappingHistoryCommand         = new DelegatedCommand(() => WindowService.Instance.Show <ScrappingHistoryWindow>());
            ShowResourceHistoryCommand          = new DelegatedCommand(() => WindowService.Instance.Show <ResourceHistoryWindow>());
            ShowSortieConsumptionHistoryCommand = new DelegatedCommand(() => WindowService.Instance.Show <SortieConsumptionHistoryWindow>());
            ShowSortieStatisticCommand          = new DelegatedCommand(() => WindowService.Instance.Show <SortieStatisticWindow>());
        }
示例#6
0
        public ToolsViewModel(GameInformationViewModel rpOwner)
        {
            r_Owner = rpOwner;

            ShowSessionToolCommand        = new DelegatedCommand(() => WindowService.Instance.Show <SessionToolWindow>(r_SessionTool));
            ShowExpeditionOverviewCommand = new DelegatedCommand(() =>
            {
                var rExpeditionOverview = r_Owner.TabItems.OfType <ExpeditionOverviewViewModel>().SingleOrDefault() ?? new ExpeditionOverviewViewModel();
                r_Owner.AddTabItem(rExpeditionOverview);
            });

            r_OpenToolPaneCommand = new DelegatedCommand <ToolViewModel>(r_Owner.AddTabItem);
            ToolPanes             = PluginService.Instance.ToolPanes?.Select(r => new ToolViewModel(r, r_OpenToolPaneCommand)).ToList().AsReadOnly();
        }
        internal MainWindowViewModel()
        {
            r_Page = new InitializationPageViewModel(this);
            GameInformation = new GameInformationViewModel(this);

            ApiService.SubscribeOnce("api_start2", delegate
            {
                IsGameStarted = true;
                OnPropertyChanged(nameof(IsGameStarted));
            });

            ShowSessionToolCommand = new DelegatedCommand(() => WindowService.Instance.Show<SessionToolWindow>(r_SessionTool));

            ApiService.Subscribe("api_req_map/start", _ => ThemeManager.Instance.ChangeAccent(Accent.Brown));
            KanColleGame.Current.ReturnedFromSortie += _ => ThemeManager.Instance.ChangeAccent(Accent.Blue);

            Preference.Instance.Game.DisableHeavyDamageBlinkingWarning.Subscribe(rpValue =>
            {
                if (SortieInfo.Current == null)
                    return;

                if (!rpValue)
                    ThemeManager.Instance.ChangeAccent(Accent.Brown);
            });

            r_BlinkingBrownAccent = new Accent("BlinkingBrown", new Uri("pack://application:,,,/HeavenlyWind;component/Themes/Accents/BlinkingBrown.xaml"));

            PropertyChangedEventListener.FromSource(NotificationService.Instance)
                .Add(nameof(NotificationService.Instance.IsBlinking), delegate
                {
                    if (NotificationService.Instance.IsBlinking)
                        ThemeManager.Instance.ChangeAccent(r_BlinkingBrownAccent);
                });

            UISetZoomCommand = new DelegatedCommand<double>(SetZoom);
            UIZoomInCommand = new DelegatedCommand(() => SetZoom(Preference.Instance.UI.Zoom.Value + .05));
            UIZoomOutCommand = new DelegatedCommand(() => SetZoom(Preference.Instance.UI.Zoom.Value - .05));

            UIZoomFactors = new[] { .25, .5, .75, 1.0, 1.25, 1.5, 1.75, 2.0, 3.0, 4.0 }.Select(r => new UIZoomInfo(r, UISetZoomCommand)).ToArray();

            ShowConstructionHistoryCommand = new DelegatedCommand(() => WindowService.Instance.Show<ConstructionHistoryWindow>());
            ShowDevelopmentHistoryCommand = new DelegatedCommand(() => WindowService.Instance.Show<DevelopmentHistoryWindow>());
            ShowSortieHistoryCommand = new DelegatedCommand(() => WindowService.Instance.Show<SortieHistoryWindow>());
            ShowExpeditionHistoryCommand = new DelegatedCommand(() => WindowService.Instance.Show<ExpeditionHistoryWindow>());
            ShowScrappingHistoryCommand = new DelegatedCommand(() => WindowService.Instance.Show<ScrappingHistoryWindow>());
            ShowResourceHistoryCommand = new DelegatedCommand(() => WindowService.Instance.Show<ResourceHistoryWindow>());
            ShowSortieConsumptionHistoryCommand = new DelegatedCommand(() => WindowService.Instance.Show<SortieConsumptionHistoryWindow>());
            ShowSortieStatisticCommand = new DelegatedCommand(() => WindowService.Instance.Show<SortieStatisticWindow>());
        }
        public ToolsViewModel(GameInformationViewModel rpOwner)
        {
            r_Owner = rpOwner;

            r_OpenToolPaneCommand = new DelegatedCommand<ToolViewModel>(r_Owner.AddTabItem);
            ToolPanes = PluginService.Instance.ToolPanes?.Select(r =>
            {
                ToolViewModel rResult;

                var rScrollBarVisibilities = r as IToolPaneScrollBarVisibilities;
                if (rScrollBarVisibilities == null)
                    rResult = new ToolWithoutScrollBarViewModel(r) { OpenCommand = r_OpenToolPaneCommand };
                else
                    rResult = new ToolWithScrollBarViewModel(r, rScrollBarVisibilities) { OpenCommand = r_OpenToolPaneCommand };

                return rResult;
            }).ToArray();
        }
        internal MainWindowViewModel()
        {
            GameInformation = new GameInformationViewModel(this);
            r_Page          = GameInformation;

            SessionService.Instance.SubscribeOnce("api_start2", delegate
            {
                IsGameStarted = true;
                OnPropertyChanged(nameof(IsGameStarted));
            });

            SessionService.Instance.Subscribe("api_req_map/start", _ => ThemeManager.Instance.ChangeAccent(Accent.Brown));
            KanColleGame.Current.ReturnedFromSortie += _ => ThemeManager.Instance.ChangeAccent(Accent.Blue);

            ShowConstructionHistoryCommand = new DelegatedCommand(() => WindowService.Instance.Show <ConstructionHistoryWindow>());
            ShowDevelopmentHistoryCommand  = new DelegatedCommand(() => WindowService.Instance.Show <DevelopmentHistoryWindow>());
            ShowSortieHistoryCommand       = new DelegatedCommand(() => WindowService.Instance.Show <SortieHistoryWindow>());
            ShowExpeditionHistoryCommand   = new DelegatedCommand(() => WindowService.Instance.Show <ExpeditionHistoryWindow>());
            ShowScrappingHistoryCommand    = new DelegatedCommand(() => WindowService.Instance.Show <ScrappingHistoryWindow>());
            ShowResourceHistoryCommand     = new DelegatedCommand(() => WindowService.Instance.Show <ResourceHistoryWindow>());
        }