Exemplo n.º 1
0
        private async void OnApplicationStateLoaded([NotNull] ApplicationStateLoadedMessage message)
        {
            if (message == null)
            {
                throw new ArgumentNullException(nameof(message));
            }

            var shellState = message.ElementOfType <ShellPersistentState>();

            if (shellState != null)
            {
                // Setting Window Size at this point has no effect, must happen after window is loaded. See OnViewReady()
                if (shellState.Size.X > 0 || shellState.Size.Y > 0)
                {
                    this.originalWindowSize = shellState.Size;
                }
                else
                {
                    this.originalWindowSize = new Point(1250, 600);
                }

                if (shellState.TopLeft.X > 0 || shellState.TopLeft.Y > 0)
                {
                    // Setting Window Top & Left at this point has no effect, must happen after window is loaded. See OnViewReady()
                    this.originalWindowTopLeft = shellState.TopLeft;
                }
            }

            var storedMainAppState = message.ElementOfType <MainApplicationState>();

            if (storedMainAppState != null)
            {
                await this.persistenceOperations.LoadDatabase(storedMainAppState.BudgetAnalyserDataStorageKey);
            }
        }
        private void OnApplicationStateLoadedMessageReceived([NotNull] ApplicationStateLoadedMessage message)
        {
            if (message == null)
            {
                throw new ArgumentNullException(nameof(message));
            }

            var storedWidgetsState = message.ElementOfType <WidgetsApplicationState>();

            if (storedWidgetsState != null)
            {
                // Now that we have the previously persisted state data we can properly intialise the service.
                WidgetGroups = this.dashboardService.LoadPersistedStateData(storedWidgetsState);
            }
        }
 private void OnApplicationStateLoaded(ApplicationStateLoadedMessage message)
 {
     if (message.RehydratedModels.ContainsKey(typeof(CustomBurnDownChartsV1)))
     {
         this.chartBuilder.CustomCharts = message.RehydratedModels[typeof(CustomBurnDownChartsV1)].AdaptModel<List<CustomAggregateBurnDownGraph>>();
     }
 }
        private void OnApplicationStateLoaded(ApplicationStateLoadedMessage message)
        {
            if (!message.RehydratedModels.ContainsKey(typeof(PersistentFiltersV1)))
            {
                return;
            }

            var rehydratedFilters = message.RehydratedModels[typeof(PersistentFiltersV1)].AdaptModel<FilterStateV1>();
            Criteria = new GlobalFilterCriteria
            {
                AccountType = rehydratedFilters.AccountType,
                BeginDate = rehydratedFilters.BeginDate,
                EndDate = rehydratedFilters.EndDate,
            };

            SendFilterAppliedMessage();
        }
 private void OnApplicationStateLoaded(ApplicationStateLoadedMessage message)
 {
     var recentFilesState = message.ElementOfType<RecentFilesPersistentModelV1>();
     if (recentFilesState != null)
     {
         files = recentFilesState.RecentlyUsedFiles;
         var handler = StateDataRestored;
         if (handler != null)
         {
             handler(this, EventArgs.Empty);
         }
     }
 }
Exemplo n.º 6
0
        private void OnApplicationStateLoaded(ApplicationStateLoadedMessage message)
        {
            if (!message.RehydratedModels.ContainsKey(typeof(LastMatchingRulesLoadedV1)))
            {
                return;
            }

            this.rulesFileName = message.RehydratedModels[typeof(LastMatchingRulesLoadedV1)].AdaptModel<string>();
            LoadRules();
        }
Exemplo n.º 7
0
        private void OnApplicationStateLoaded(ApplicationStateLoadedMessage message)
        {
            try
            {
                if (!message.RehydratedModels.ContainsKey(typeof(LastBudgetLoadedV1)))
                {
                    return;
                }

                var budgetFileName = message.RehydratedModels[typeof(LastBudgetLoadedV1)].AdaptModel<string>();
                if (string.IsNullOrWhiteSpace(budgetFileName))
                {
                    LoadDemoBudget();
                    return;
                }

                LoadBudget(budgetFileName);
            }
            catch (FileFormatException)
            {
                HandleBudgetFileExceptions("The last Budget file is an invalid file format. A empty default file will use the default file instead.");
            }
            catch (FileNotFoundException)
            {
                HandleBudgetFileExceptions("The last Budget file used cannot be found. A empty default file will use the default file instead.");
            }
        }
Exemplo n.º 8
0
        private void OnApplicationStateLoaded(ApplicationStateLoadedMessage message)
        {
            if (!message.RehydratedModels.ContainsKey(typeof(ShellPersistentStateV1)))
            {
                return;
            }

            var shellState = message.RehydratedModels[typeof(ShellPersistentStateV1)].AdaptModel<ShellStateModel>();
            // Setting Window Size at this point has no effect, must happen after window is loaded. See OnViewReady()
            if (shellState.Size.X > 0 || shellState.Size.Y > 0)
            {
                this.originalWindowSize = shellState.Size;
            }
            else
            {
                this.originalWindowSize = new Point(1250, 600);
            }

            if (shellState.TopLeft.X > 0 || shellState.TopLeft.Y > 0)
            {
                // Setting Window Top & Left at this point has no effect, must happen after window is loaded. See OnViewReady()
                this.originalWindowTopLeft = shellState.TopLeft;
            }
        }