Beispiel #1
0
 public SettingsViewModel(
     INavigationService navigationService,
     IAppThemeService appThemeService) :
     base(navigationService)
 {
     Title            = "Settings";
     _appThemeService = appThemeService;
 }
Beispiel #2
0
        //private IPermissionService _permissionService;

        public MapTabViewModel(
            INavigationService navigationService,
            IPinModelService pinModelService,
            IDialogService dialogService,
            IAuthorizationService authorizationService,
            IAppThemeService appThemeService) :
            base(navigationService)
        {
            Title = "Map";

            _pinModelService      = pinModelService;
            _dialogService        = dialogService;
            _authorizationService = authorizationService;
            _appThemeService      = appThemeService;
            //IPermissionService permissionService_permissionService = permissionService;

            Pins = new ObservableCollection <Pin>();

            Categories = new List <CategoriesForPin>
            {
                new CategoriesForPin {
                    Name = "Gyms"
                },
                new CategoriesForPin {
                    Name = "Restaurants"
                },
                new CategoriesForPin {
                    Name = "Hotels"
                },
                new CategoriesForPin {
                    Name = "Supermarkets"
                },
                new CategoriesForPin {
                    Name = "Schools"
                },
                new CategoriesForPin {
                    Name = "Place to rest"
                },
                new CategoriesForPin {
                    Name = "Work"
                },
                new CategoriesForPin {
                    Name = "Home"
                },
                new CategoriesForPin {
                    Name = "Airports"
                },
                new CategoriesForPin {
                    Name = "Football stadium"
                }
            };
        }
Beispiel #3
0
        public AddPinViewModel(
            INavigationService navigationService,
            IPinModelService pinModelService,
            IAuthorizationService authorization,
            IPageDialogService pageDialogService,
            IAppThemeService appThemeService) :
            base(navigationService)
        {
            Title = "Add pin";

            _pinModelService   = pinModelService;
            _authorization     = authorization;
            _pageDialogService = pageDialogService;
            _appThemeService   = appThemeService;

            Categories = new List <CategoriesForPin>
            {
                new CategoriesForPin {
                    Name = "Gyms"
                },
                new CategoriesForPin {
                    Name = "Restaurants"
                },
                new CategoriesForPin {
                    Name = "Hotels"
                },
                new CategoriesForPin {
                    Name = "Supermarkets"
                },
                new CategoriesForPin {
                    Name = "Schools"
                },
                new CategoriesForPin {
                    Name = "Place to rest"
                },
                new CategoriesForPin {
                    Name = "Work"
                },
                new CategoriesForPin {
                    Name = "Home"
                },
                new CategoriesForPin {
                    Name = "Airports"
                },
                new CategoriesForPin {
                    Name = "Football stadium"
                }
            };
        }
Beispiel #4
0
        protected override void OnStartup(StartupEventArgs e)
        {
            if (e.Args.Contains("-ToastActivated"))
            {
                return;
            }

            if (!Debugger.IsAttached)
            {
                this.DispatcherUnhandledException += this.OnDispatcherUnhandledException;
            }

            OperatingSystem OS = Environment.OSVersion;

            if (OS.Version.Major <= 5)
            {
                MessageBox.Show(MiscRes.UnsupportedOSError, MiscRes.NoticeMessageTitle, MessageBoxButton.OK, MessageBoxImage.Warning);
                MessageBox.Show(MiscRes.UnsupportedOSError, MiscRes.NoticeMessageTitle, MessageBoxButton.OK, MessageBoxImage.Warning);
                this.Shutdown();
                return;
            }

#if PSEUDOLOCALIZER_ENABLED
            Delay.PseudoLocalizer.Enable(typeof(CommonRes));
            Delay.PseudoLocalizer.Enable(typeof(MainRes));
            Delay.PseudoLocalizer.Enable(typeof(EnumsRes));
            Delay.PseudoLocalizer.Enable(typeof(EncodingRes));
            Delay.PseudoLocalizer.Enable(typeof(OptionsRes));
            Delay.PseudoLocalizer.Enable(typeof(PreviewRes));
            Delay.PseudoLocalizer.Enable(typeof(LogRes));
            Delay.PseudoLocalizer.Enable(typeof(SubtitleRes));
            Delay.PseudoLocalizer.Enable(typeof(QueueTitlesRes));
            Delay.PseudoLocalizer.Enable(typeof(ChapterMarkersRes));
            Delay.PseudoLocalizer.Enable(typeof(MiscRes));
#endif

            JsonSettings.SetDefaultSerializationSettings();

            Ioc.SetUp();

            try
            {
                Database.Initialize();
            }
            catch (Exception)
            {
                Environment.Exit(0);
            }

            Config.EnsureInitialized(Database.Connection);

            var interfaceLanguageCode = Config.InterfaceLanguageCode;
            if (!string.IsNullOrWhiteSpace(interfaceLanguageCode))
            {
                var cultureInfo = new CultureInfo(interfaceLanguageCode);
                Thread.CurrentThread.CurrentCulture       = cultureInfo;
                Thread.CurrentThread.CurrentUICulture     = cultureInfo;
                CultureInfo.DefaultThreadCurrentCulture   = cultureInfo;
                CultureInfo.DefaultThreadCurrentUICulture = cultureInfo;
            }

            Stopwatch sw = Stopwatch.StartNew();

            if (Config.UseCustomPreviewFolder && FileUtilities.HasWriteAccessOnFolder(Config.PreviewOutputFolder))
            {
                Environment.SetEnvironmentVariable("TMP", Config.PreviewOutputFolder, EnvironmentVariableTarget.Process);
                FileUtilities.OverrideTempFolder = true;
                FileUtilities.TempFolderOverride = Config.PreviewOutputFolder;
            }

            var updater = StaticResolver.Resolve <IUpdater>();

            sw.Stop();
            System.Diagnostics.Debug.WriteLine("Startup time: " + sw.Elapsed);

            updater.HandlePendingUpdate();

            try
            {
                // Check if we're a secondary instance
                IsPrimaryInstance = mutex.WaitOne(TimeSpan.Zero, true);
            }
            catch (AbandonedMutexException)
            {
            }

            this.GlobalInitialize();

            this.appThemeService = StaticResolver.Resolve <IAppThemeService>();
            this.appThemeService.AppThemeObservable.Subscribe(appTheme =>
            {
                if (appTheme != this.currentTheme)
                {
                    this.currentTheme = appTheme;
                    this.ChangeTheme(new Uri($"/Themes/{appTheme}.xaml", UriKind.Relative));

                    bool isDark = appTheme == AppTheme.Dark;

                    string fluentTheme = isDark ? "Dark" : "Light";
                    ThemeManager.ChangeTheme(this, fluentTheme + ".Cobalt");

                    Color ribbonTextColor = isDark ? Colors.White : Colors.Black;
                    this.Resources["Fluent.Ribbon.Brushes.LabelTextBrush"] = new SolidColorBrush(ribbonTextColor);
                }
            });

            var mainVM = new MainViewModel();
            StaticResolver.Resolve <IWindowManager>().OpenWindow(mainVM);
            mainVM.OnLoaded();

            if (e.Args.Length > 0)
            {
                mainVM.HandlePaths(new List <string> {
                    e.Args[0]
                });
            }

            if (!Utilities.IsPortable && IsPrimaryInstance)
            {
                AutomationHost.StartListening();
            }

            base.OnStartup(e);
        }