private void SetCustomWindowSizeFromAppSettings()
        {
            IsSettingWindowSize = true;

            string customSize = AppSettingsUtil.GetAppSetting(SettingKey.CustomWindowSize);

            if (String.IsNullOrEmpty(customSize))
            {
                IsSettingWindowSize = false;
                return;
            }

            string[] dimensions = customSize.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);


            bool didParseWidth  = double.TryParse(dimensions[0], out double newWidth);
            bool didParseHeight = double.TryParse(dimensions[1], out double newHeight);

            if (didParseWidth && didParseHeight)
            {
                this.Width  = newWidth;
                this.Height = newHeight;
            }

            IsSettingWindowSize = false;
        }
Esempio n. 2
0
        public AssetStoreViewModel()
        {
            IsInstallingAsset = false;
            DisplayMaps       = true;
            SetSelectedCategoriesFromAppSettings();
            FetchAllPreviewImages = AppSettingsUtil.GetAppSetting(SettingKey.FetchAllPreviewImages).Equals("true", StringComparison.OrdinalIgnoreCase);

            if (AppSettingsUtil.GetAppSetting(SettingKey.DeleteDownloadAfterAssetInstall) == "")
            {
                DeleteDownloadAfterInstall = true; // default to true if does not exist in app config
            }
            else
            {
                DeleteDownloadAfterInstall = AppSettingsUtil.GetAppSetting(SettingKey.DeleteDownloadAfterAssetInstall).Equals("true", StringComparison.OrdinalIgnoreCase);
            }

            InstallStatusList = new List <string>()
            {
                defaultInstallStatusValue, "Installed", "Not Installed"
            };
            SelectedInstallStatus = defaultInstallStatusValue;

            AuthorList = new List <AuthorDropdownViewModel>()
            {
                new AuthorDropdownViewModel(defaultAuthorValue, 0)
            };
            AuthorToFilterBy = AuthorList[0];

            _catalogCache = GetCurrentCatalog();
            ReloadAllAssets();
            CheckForCatalogUpdatesAsync(clearCache: false);
        }
Esempio n. 3
0
        public ProjectWatcherViewModel()
        {
            _importViewModel = new ComputerImportViewModel()
            {
                IsZipFileImport = false
            };
            PathToProject = AppSettingsUtil.GetAppSetting(SettingKey.ProjectWatcherPath);

            UnwatchProject();
        }
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            string sessionPath = AppSettingsUtil.GetAppSetting(SettingKey.PathToSession);

            if (string.IsNullOrEmpty(sessionPath))
            {
                sessionPath = SessionPath.GetPathFromRegistry();
            }

            SessionPath.ToSession = sessionPath;
        }
Esempio n. 5
0
 public UploadAssetViewModel()
 {
     IsUploadingAsset      = false;
     HasAuthenticated      = false;
     SelectedCategory      = "";
     StatusMessage         = DefaultStatusMesssage;
     PathToCredentialsFile = AppSettingsUtil.GetAppSetting(SettingKey.PathToCredentialsFile);
     Author             = AppSettingsUtil.GetAppSetting(SettingKey.UploaderAuthor);
     SelectedBucketName = AppSettingsUtil.GetAppSetting(SettingKey.AssetStoreSelectedBucket);
     InitAvailableCategories();
 }
Esempio n. 6
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            string sessionPath = AppSettingsUtil.GetAppSetting(SettingKey.PathToSession);

            if (string.IsNullOrEmpty(sessionPath))
            {
                sessionPath = RegistryHelper.GetPathFromRegistry();
            }

            SessionPath.ToSession = sessionPath;


#if DEBUG
            NLog.LogManager.ThrowExceptions = true;
#endif

            LogAppNameAndVersion();
        }
Esempio n. 7
0
        private void SetSelectedCategoriesFromAppSettings()
        {
            _displayDecks      = AppSettingsUtil.GetAppSetting(SettingKey.AssetStoreDecksChecked).Equals("true", StringComparison.OrdinalIgnoreCase);
            _displayGriptapes  = AppSettingsUtil.GetAppSetting(SettingKey.AssetStoreGriptapesChecked).Equals("true", StringComparison.OrdinalIgnoreCase);
            _displayHats       = AppSettingsUtil.GetAppSetting(SettingKey.AssetStoreHatsChecked).Equals("true", StringComparison.OrdinalIgnoreCase);
            _displayMaps       = AppSettingsUtil.GetAppSetting(SettingKey.AssetStoreMapsChecked).Equals("true", StringComparison.OrdinalIgnoreCase);
            _displayPants      = AppSettingsUtil.GetAppSetting(SettingKey.AssetStorePantsChecked).Equals("true", StringComparison.OrdinalIgnoreCase);
            _displayShirts     = AppSettingsUtil.GetAppSetting(SettingKey.AssetStoreShirtsChecked).Equals("true", StringComparison.OrdinalIgnoreCase);
            _displayShoes      = AppSettingsUtil.GetAppSetting(SettingKey.AssetStoreShoesChecked).Equals("true", StringComparison.OrdinalIgnoreCase);
            _displayTrucks     = AppSettingsUtil.GetAppSetting(SettingKey.AssetStoreTrucksChecked).Equals("true", StringComparison.OrdinalIgnoreCase);
            _displayWheels     = AppSettingsUtil.GetAppSetting(SettingKey.AssetStoreWheelsChecked).Equals("true", StringComparison.OrdinalIgnoreCase);
            _displayMeshes     = AppSettingsUtil.GetAppSetting(SettingKey.AssetStoreMeshesChecked).Equals("true", StringComparison.OrdinalIgnoreCase);
            _displayCharacters = AppSettingsUtil.GetAppSetting(SettingKey.AssetStoreCharactersChecked).Equals("true", StringComparison.OrdinalIgnoreCase);

            _displayAll = DisplayDecks && DisplayGriptapes && DisplayHats && DisplayMaps && DisplayPants && DisplayShirts && DisplayShoes && DisplayTrucks && DisplayWheels && DisplayMeshes && DisplayCharacters;

            RaisePropertyChangedEventsForCategories();
            RefreshFilteredAssetList();
        }
Esempio n. 8
0
        public MainWindow()
        {
            InitializeComponent();

            SetCustomWindowSizeFromAppSettings();

            ViewModel = new MainWindowViewModel();
            ViewModel.ReloadAvailableMapsInBackground();

            this.DataContext = ViewModel;
            this.Title       = $"{App.GetAppName()} - v{App.GetAppVersion()}";

            SelectedTabIndex = tabControl.SelectedIndex;

            // set window state
            string windowStateVal = AppSettingsUtil.GetAppSetting(SettingKey.WindowState);

            if (!string.IsNullOrWhiteSpace(windowStateVal) && WindowState.TryParse(windowStateVal, out WindowState state))
            {
                this.WindowState = state;
            }
        }
        public MainWindow()
        {
            InitializeComponent();

            SetCustomWindowSizeFromAppSettings();

            ViewModel = new MainWindowViewModel();

            MessageService.Instance.MessageReceived += MessageService_MessageReceived;

            this.DataContext = ViewModel;
            this.Title       = $"{App.GetAppName()} - v{App.GetAppVersion()}";

            SelectedTabIndex = tabControl.SelectedIndex;

            // set window state
            string windowStateVal = AppSettingsUtil.GetAppSetting(SettingKey.WindowState);

            if (!string.IsNullOrWhiteSpace(windowStateVal) && WindowState.TryParse(windowStateVal, out WindowState state))
            {
                this.WindowState = state;
            }
        }