public InstalledPackagesView(InstalledPackagesViewModel viewModel)
 {
     this.viewModel = viewModel;
     this.DataContext = viewModel;
     InitializeComponent();
     Logging.Analytics.TrackScreenView("PackageManager");
 }
 public InstalledPackagesView(InstalledPackagesViewModel viewModel)
 {
     this.viewModel = viewModel;
     this.DataContext = viewModel;
     InitializeComponent();
 }
Ejemplo n.º 3
0
        /// <summary>
        /// The PreferencesViewModel constructor basically initialize all the ItemsSource for the corresponding ComboBox in the View (PreferencesView.xaml)
        /// </summary>
        public PreferencesViewModel(DynamoViewModel dynamoViewModel)
        {
            this.preferenceSettings            = dynamoViewModel.PreferenceSettings;
            this.pythonScriptEditorTextOptions = dynamoViewModel.PythonScriptEditorTextOptions;
            this.runPreviewEnabled             = dynamoViewModel.HomeSpaceViewModel.RunSettingsViewModel.RunButtonEnabled;
            this.homeSpace                  = dynamoViewModel.HomeSpace;
            this.dynamoViewModel            = dynamoViewModel;
            this.installedPackagesViewModel = new InstalledPackagesViewModel(dynamoViewModel,
                                                                             dynamoViewModel.PackageManagerClientViewModel.PackageManagerExtension.PackageLoader);

            // Scan for engines
            AddPythonEnginesOptions();

            PythonEngineManager.Instance.AvailableEngines.CollectionChanged += PythonEnginesChanged;

            //Sets SelectedPythonEngine.
            //If the setting is empty it corresponds to the default python engine
            var engine = PythonEnginesList.FirstOrDefault(x => x.Equals(preferenceSettings.DefaultPythonEngine));

            SelectedPythonEngine = string.IsNullOrEmpty(engine) ? Res.DefaultPythonEngineNone : preferenceSettings.DefaultPythonEngine;

            string languages = Wpf.Properties.Resources.PreferencesWindowLanguages;

            LanguagesList    = new ObservableCollection <string>(languages.Split(','));
            SelectedLanguage = languages.Split(',').First();

            FontSizeList = new ObservableCollection <string>();
            FontSizeList.Add(Wpf.Properties.Resources.ScalingSmallButton);
            FontSizeList.Add(Wpf.Properties.Resources.ScalingMediumButton);
            FontSizeList.Add(Wpf.Properties.Resources.ScalingLargeButton);
            FontSizeList.Add(Wpf.Properties.Resources.ScalingExtraLargeButton);
            SelectedFontSize = Wpf.Properties.Resources.ScalingMediumButton;

            NumberFormatList = new ObservableCollection <string>();
            NumberFormatList.Add(Wpf.Properties.Resources.DynamoViewSettingMenuNumber0);
            NumberFormatList.Add(Wpf.Properties.Resources.DynamoViewSettingMenuNumber00);
            NumberFormatList.Add(Wpf.Properties.Resources.DynamoViewSettingMenuNumber000);
            NumberFormatList.Add(Wpf.Properties.Resources.DynamoViewSettingMenuNumber0000);
            NumberFormatList.Add(Wpf.Properties.Resources.DynamoViewSettingMenuNumber00000);
            SelectedNumberFormat = preferenceSettings.NumberFormat;

            runSettingsIsChecked = preferenceSettings.DefaultRunType;
            RunPreviewIsChecked  = preferenceSettings.ShowRunPreview;

            //By Default the warning state of the Visual Settings tab (Group Styles section) will be disabled
            isWarningEnabled = false;

            StyleItemsList = LoadStyles(preferenceSettings.GroupStyleItemsList);

            //When pressing the "Add Style" button some controls will be shown with some values by default so later they can be populated by the user
            AddStyleControl = new StyleItem()
            {
                GroupName = "", HexColorString = "#" + GetRandomHexStringColor()
            };

            //This piece of code will populate all the description text for the RadioButtons in the Geometry Scaling section.
            optionsGeometryScale = new GeometryScalingOptions();

            UpdateGeoScaleRadioButtonSelected(dynamoViewModel.ScaleFactorLog);

            optionsGeometryScale.DescriptionScaleRange = new ObservableCollection <string>();
            optionsGeometryScale.DescriptionScaleRange.Add(string.Format(Res.ChangeScaleFactorPromptDescriptionContent, scaleRanges[GeometryScaleSize.Small].Item2,
                                                                         scaleRanges[GeometryScaleSize.Small].Item3));
            optionsGeometryScale.DescriptionScaleRange.Add(string.Format(Res.ChangeScaleFactorPromptDescriptionContent, scaleRanges[GeometryScaleSize.Medium].Item2,
                                                                         scaleRanges[GeometryScaleSize.Medium].Item3));
            optionsGeometryScale.DescriptionScaleRange.Add(string.Format(Res.ChangeScaleFactorPromptDescriptionContent, scaleRanges[GeometryScaleSize.Large].Item2,
                                                                         scaleRanges[GeometryScaleSize.Large].Item3));
            optionsGeometryScale.DescriptionScaleRange.Add(string.Format(Res.ChangeScaleFactorPromptDescriptionContent, scaleRanges[GeometryScaleSize.ExtraLarge].Item2,
                                                                         scaleRanges[GeometryScaleSize.ExtraLarge].Item3));

            SavedChangesLabel   = string.Empty;
            SavedChangesTooltip = string.Empty;

            preferencesTabs = new Dictionary <string, TabSettings>();
            preferencesTabs.Add("General", new TabSettings()
            {
                Name = "General", ExpanderActive = string.Empty
            });
            preferencesTabs.Add("Features", new TabSettings()
            {
                Name = "Features", ExpanderActive = string.Empty
            });
            preferencesTabs.Add("VisualSettings", new TabSettings()
            {
                Name = "VisualSettings", ExpanderActive = string.Empty
            });
            preferencesTabs.Add("Package Manager", new TabSettings()
            {
                Name = "Package Manager", ExpanderActive = string.Empty
            });

            //create a packagePathsViewModel we'll use to interact with the package search paths list.
            var loadPackagesParams = new LoadPackageParams
            {
                Preferences = preferenceSettings
            };
            var customNodeManager = dynamoViewModel.Model.CustomNodeManager;
            var packageLoader     = dynamoViewModel.Model.GetPackageManagerExtension()?.PackageLoader;

            PackagePathsViewModel = new PackagePathViewModel(packageLoader, loadPackagesParams, customNodeManager);

            WorkspaceEvents.WorkspaceSettingsChanged += PreferencesViewModel_WorkspaceSettingsChanged;

            PropertyChanged += Model_PropertyChanged;
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Create a package filter for All
 /// </summary>
 /// <param name="viewModel">Back pointer to parent view model</param>
 public PackageFilter(InstalledPackagesViewModel viewModel)
 {
     Name      = Resources.PackageFilter_Name_All;
     ViewModel = viewModel;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Create a package filter
 /// </summary>
 /// <param name="name">Name of filter</param>
 /// <param name="viewModel">Back pointer to parent view model</param>
 public PackageFilter(string name, InstalledPackagesViewModel viewModel)
 {
     Name      = name;
     ViewModel = viewModel;
 }