예제 #1
0
        public void SetData(string name, int tris, int verts, int sizeKB)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                ModelName   = Loc.GetText("NoModelSelected");
                ModelTris   = Loc.GetTextFormatted("NumberTriangles", "-");
                ModelVerts  = Loc.GetTextFormatted("NumberVertices", "-");
                ModelSizeKB = Loc.GetTextFormatted("NumberKB", "-");
                IsLoaded    = false;
            }
            else
            {
                ModelName   = name;
                ModelTris   = Loc.GetTextFormatted("NumberTriangles", tris);
                ModelVerts  = Loc.GetTextFormatted("NumberVertices", verts);
                ModelSizeKB = Loc.GetTextFormatted("NumberKB", sizeKB);
                IsLoaded    = true;
            }

            NotifyPropertyChanged(nameof(ModelName));
            NotifyPropertyChanged(nameof(ModelTris));
            NotifyPropertyChanged(nameof(ModelVerts));
            NotifyPropertyChanged(nameof(ModelSizeKB));
            NotifyPropertyChanged(nameof(IsLoaded));
        }
        private async void AutoDetectProgramsAsync()
        {
            logger.Info("Settings window: AutoDetectProgramsAsync");

            LoadingDialog loading = new LoadingDialog(Loc.GetText("LookingFor3dSoftwareShortcuts"), Loc.GetText("AutoDetect3DSoftware"));

            loading.ShowAsync();

            Task <IEnumerable <string> > autoAddTask = Task.Run(AutoFillProgramsTableAsync);
            await autoAddTask;

            loading.CloseDialog();

            if (autoAddTask.Result.Any())
            {
                logger.Info($"Settings window: Autodetected {autoAddTask.Result.Count()} programs: [{string.Join("] [", autoAddTask.Result)}]");

                await new MessageDialog(Loc.GetTextFormatted("AutoDetect3DSoftware_FoundList", autoAddTask.Result.Count(), string.Join("\n", autoAddTask.Result)),
                                        Loc.GetText("AutoDetect3DSoftware"), Loc.GetText("OK"), "", "").ShowAsync();
            }
            else
            {
                logger.Info("Settings window: Autodetected 0 programs.");
                await new MessageDialog(Loc.GetText("AutoDetect3DSoftware_NothingFound"), Loc.GetText("AutoDetect3DSoftware"), Loc.GetText("OK"), "", "").ShowAsync();
            }
        }
예제 #3
0
 public string CalculateCacheSize(Dispatcher d)
 {
     if (!processingCacheSize)
     {
         processingCacheSize = true;
         CacheSize           = Loc.GetText("Calculating...");
         Task.Factory.StartNew(new Action(() =>
         {
             var size = cacheObject.CacheSize();
             d.Invoke(new Action(() =>
             {
                 if (size < 0)
                 {
                     CacheSize = Loc.GetText("SizeNotAvailable");
                 }
                 else
                 {
                     CacheSize = Loc.GetTextFormatted("NumberKB", Math.Round((size / 1024f)));
                 }
             }));
             processingCacheSize = false;
         }));
     }
     return(Loc.GetText("Calculating..."));
 }
        private void SetUILanguage(string newLanguage = "")
        {
            this.Title         = $"{Loc.GetText("AppName")} {Loc.GetText("Settings")}";
            tbWindowTitle.Text = Loc.GetText("Configuration");
            {
                GeneralSettings.Header    = Loc.GetText("GeneralSettingsName");
                tbLanguageSetting.Text    = Loc.GetText("Language");
                tbCacheFolder.Text        = Loc.GetText("CacheFolderSetting");
                tbCacheFolder.ToolTip     = Loc.GetText("tooltipCacheFolderSetting");
                tbEnableDebugLogs.Text    = Loc.GetText("EnableDebugLogs");
                btnOpenLogsFolder.Content = $"   {Loc.GetText("OpenLogsFolder")}   ";
                tbThumnailStyle.Text      = Loc.GetText("ThumbnailStyle");
                chkEnableThumnailColorsByShaders.Content = Loc.GetText("EnableThumnailColorsByShaders");
                chkEnableThumnailColorsByShaders.ToolTip = Loc.GetText("tooltipEnableThumnailColorsByShaders");
                chkEnableChangingViewColorChangesThumnailColor.Content = Loc.GetText("EnableChangingViewChangesThumnails");
                chkEnableChangingViewColorChangesThumnailColor.ToolTip = Loc.GetText("tooltipEnableChangingViewChangesThumnails");
            }

            {
                ProgramsSettings.Header    = Loc.GetText("ProgramsSettingsName");
                tbProgramsGridTitle.Text   = Loc.GetText("ProgramsTable");
                tbProgramsDescription.Text = Loc.GetText("ProgramsSettingsDescription");
                btnAddNewProgram.Content   = Loc.GetText("AddNew");
            }

            {
                AdvancedSettings.Header = Loc.GetText("AdvancedSettingsName");

                tbPerformance.Text = Loc.GetText("PerformanceSettings");

                chkEnableMeshDecimate.Content      = Loc.GetText("EnableMeshDecimate");
                nmbMeshDecimateMinTris.Description = Loc.GetText("MeshDecimateMinTris");
                chkEnableMeshDecimate.ToolTip      = nmbMeshDecimateMinTris.ToolTip = Loc.GetText("tooltipEnableMeshDecimate");

                chkEnableMaxSizeModel.Content     = Loc.GetText("EnableMaxSizeModel");
                nmbMaxSizeModelToView.Description = Loc.GetText("MaxSizeModelToView");
                nmbMaxSizeModelToView.ToolTip     = chkEnableMaxSizeModel.ToolTip = Loc.GetText("tooltipEnableMaxSizeModel");

                chkEnableReduceThumbnailResolution.Content    = Loc.GetText("GenerateThumnailLowRes");
                chkEnableReduceThumbnailResolution.ToolTip    = Loc.GetText("tooltipGenerateThumnailLowRes");
                chkReduceEnableReduceThumbnailQuality.Content = Loc.GetText("UseFastThumbnailDrawing");
                chkReduceEnableReduceThumbnailQuality.ToolTip = Loc.GetText("tooltipUseFastThumbnailDrawing");
            }

            btnAutoretectPrograms.Content = Loc.GetText("AutoDetect3DSoftwareButton");
            btnAccept.Content             = Loc.GetText("Accept");
            btnCancel.Content             = Loc.GetText("Cancel");
        }
예제 #5
0
        public AboutDialog()
        {
            InitializeComponent();
            this.Title             = ""; // Loc.GetText("About"); // Replaced with app logo/name.
            this.Message.Text      = Loc.GetText("About_MainDescription");
            tbGithubLink.Text      = $"{Loc.GetText("CodePlatformName")}: ";
            GithubLink.Content     = "https://github.com/Alriac/STL_Showcase";
            tbIssuesLink.Text      = $"{Loc.GetText("CodePlatformIssues")}: ";
            GithubLink.NavigateUri = new Uri("https://github.com/Alriac/STL_Showcase");
            IssuesLink.Content     = "https://github.com/Alriac/STL_Showcase/issues";
            IssuesLink.NavigateUri = new Uri("https://github.com/Alriac/STL_Showcase/issues");

            this.tbVersion.Text = $"{Loc.GetText("Version")}: ";
            this.Version.Text   = App.AppVersion;

            this.PrimaryButtonText   = Loc.GetText("OK");
            this.SecondaryButtonText = string.Empty;
            this.CloseButtonText     = string.Empty;
        }
        private void btnOpenLogsFolder_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string appPath  = System.IO.Path.GetDirectoryName(Assembly.GetAssembly(typeof(ConfigurationWindow)).Location);
                string logsPath = System.IO.Path.Combine(appPath, "Logs");

                if (Directory.Exists(logsPath))
                {
                    System.Diagnostics.Process.Start(logsPath);
                }
                else
                {
                    new MessageDialog(Loc.GetText("LogsFolderDontExists"), Loc.GetText("OpenLogsFolder"), Loc.GetText("OK"), "", "").ShowAsync();
                }
            }
            catch (Exception ex)
            {
                new MessageDialog(Loc.GetText("ErrorOpeningLogsFolder"), Loc.GetText("OpenLogsFolder"), Loc.GetText("OK"), "", "").ShowAsync();
                logger.Trace(ex, "Error when trying to open logs folder (yet here you are, reading a log file).");
            }
        }
        private void InitializeSettingsFields()
        {
            _modelConfigSettings = new ModelConfigSettings();
            _modelConfigSettings.LoadSettings();

            #region General Settings
            {
                IEnumerable <CultureInfo> supportedCultures = CultureInfo.GetCultures(CultureTypes.NeutralCultures).Where(ci => Loc.Ins.LoadedLanguages.Contains(ci.TwoLetterISOLanguageName));
                SupportedLanguages = new ObservableCollection <ComboboxItemToString>(supportedCultures
                                                                                     .Select(ci => new ComboboxItemToString()
                {
                    ID = ci.TwoLetterISOLanguageName, DisplayName = ci.NativeName.First().ToString().ToUpper() + ci.NativeName.Substring(1)
                })
                                                                                     .OrderBy(cbi => cbi.DisplayName));

                cbLanguage.SelectedItem = SupportedLanguages.FirstOrDefault(cbi => cbi.ID == Loc.Ins.CurrentLanguage);

                IEnumerable <CacheEnums.CachePathType> cachePathTypes = (CacheEnums.CachePathType[])Enum.GetValues(typeof(CacheEnums.CachePathType));
                CacheFolders = new ObservableCollection <ComboboxItemToString>(cachePathTypes
                                                                               .Select(n => new ComboboxItemToString()
                {
                    ID = ((int)n).ToString(), DisplayName = Loc.GetText(n.ToString())
                })
                                                                               .OrderBy(n => n.DisplayName));

                cbCacheFolder.SelectedItem = CacheFolders.FirstOrDefault(cbi => cbi.ID == ((int)_modelConfigSettings.CachePath).ToString());


                chkEnableDebugLogs.DataContext = _modelConfigSettings;

                RenderTypeScrollItemContainer.DataContext = _model3DViewInfo;
                RenderTypeScrollItemContainer.UpdateLayout();

                chkEnableThumnailColorsByShaders.DataContext = _modelConfigSettings;
                chkEnableChangingViewColorChangesThumnailColor.DataContext = _modelConfigSettings;
                // TODO: Set the checked item, somehow.
                //RenderTypeScrollItemContainer.ItemContainerGenerator.StatusChanged += (sender, e) =>
                //{
                //    if (RenderTypeScrollItemContainer.ItemContainerGenerator.Status == GeneratorStatus.ContainersGenerated)
                //    {
                //        ContentPresenter cp = RenderTypeScrollItemContainer.ItemContainerGenerator.ContainerFromIndex(0) as ContentPresenter;
                //    }
                //};
            }
            #endregion General Settings

            #region Linked Programs Settings
            {
                dgPrograms.DataContext = _modelConfigSettings;
            }
            #endregion Linked Programs Settings

            #region Advanced Settings
            {
                chkEnableMeshDecimate.DataContext  = _modelConfigSettings;
                nmbMeshDecimateMinTris.DataContext = _modelConfigSettings;
                chkEnableMaxSizeModel.DataContext  = _modelConfigSettings;
                nmbMaxSizeModelToView.DataContext  = _modelConfigSettings;

                chkEnableReduceThumbnailResolution.DataContext    = _modelConfigSettings;
                chkReduceEnableReduceThumbnailQuality.DataContext = _modelConfigSettings;
            }
            #endregion Advanced Settings
        }