Exemple #1
0
 /// <summary>
 /// because InitializePlugins needs API, so LoadPlugins needs to be called first
 /// todo happlebao The API should be removed
 /// </summary>
 /// <param name="settings"></param>
 public static void LoadPlugins(PluginsSettings settings)
 {
     _metadatas = PluginConfig.Parse(Directories);
     Settings   = settings;
     Settings.UpdatePluginSettings(_metadatas);
     AllPlugins = PluginsLoader.Plugins(_metadatas, Settings);
 }
Exemple #2
0
        public static List <PluginPair> Plugins(List <PluginMetadata> metadatas, PluginsSettings settings)
        {
            var csharpPlugins     = CSharpPlugins(metadatas).ToList();
            var executablePlugins = ExecutablePlugins(metadatas);
            var plugins           = csharpPlugins.Concat(executablePlugins).ToList();

            return(plugins);
        }
        public static List <PluginPair> Plugins(List <PluginMetadata> metadatas, PluginsSettings settings)
        {
            var dotnetPlugins     = DotNetPlugins(metadatas);
            var pythonPlugins     = PythonPlugins(metadatas, settings.PythonDirectory);
            var executablePlugins = ExecutablePlugins(metadatas);
            var plugins           = dotnetPlugins.Concat(pythonPlugins).Concat(executablePlugins).ToList();

            return(plugins);
        }
 public UserControl GetControlForSettings(PluginsSettings settings)
 {
     return(new UserControl()
     {
         Content = new Label()
         {
             Content = "I am no implemented user control Of CSV DaTA"
         }
     });
 }
Exemple #5
0
        //public LICSRequest GetCustomerDataFromXml(string fileName)
        //{

        //    XmlSerializer xS = new XmlSerializer(typeof(OutputPayLoad));
        //    LICSRequest licsRequest = new LICSRequest();
        //    using (FileStream fs = new FileStream(fileName, FileMode.Open))
        //    {
        //        OutputPayLoad customerInfo =(OutputPayLoad) xS.Deserialize(fs);
        //        licsRequest = customerInfo.ConvertToLICSRequest();
        //    }

        //    return licsRequest;
        //}

        public void SaveSettings(PluginsSettings settings)
        {
            if (_viewModel == null)
            {
                return;
            }
            // if(_viewModel.CurrentPluginSettings.IsActivated)
            {
                //     settings.XmlSettings = _viewModel.CurrentPluginSettings;
            }
        }
 public void SaveSettings(PluginsSettings settings)
 {
     if (_msSqlPluginSettingsViewModel == null)
     {
         return;
     }
     if (_msSqlPluginSettingsViewModel.CurrentPluginSettings.IsActivated)
     {
         settings.MsSqlSettings = _msSqlPluginSettingsViewModel.CurrentPluginSettings;
     }
 }
        public UserControl GetControlForSettings(PluginsSettings settings)
        {
            //ManualMaping.View.ManualMappingView view = new ManualMaping.View.ManualMappingView();
            //view.DataContext = new ManualMaping.ViewModel.ManualMapperViewModel();
            if (_msSqlPluginSettingsView == null)
            {
                _msSqlPluginSettingsView = new MainDBSettindsView();
            }
            if (_msSqlPluginSettingsViewModel == null)
            {
                _msSqlPluginSettingsViewModel = new MainDBSettingsViewModel(settings.MsSqlSettings);
            }

            _msSqlPluginSettingsView.DataContext = _msSqlPluginSettingsViewModel;
            return(_msSqlPluginSettingsView);
        }
        //BaseLicsRequestSettings _settings;
        //public CustomerDataComposition(BaseLicsRequestSettings settings) : this()
        //{
        //    _settings = settings;
        //}



        public PluginsSettings SavePluginsSettings()
        {
            PluginsSettings ps = new PluginsSettings();

            try
            {
                foreach (var plugin in CustomerDataPlugins)
                {
                    plugin.Value.SaveSettings(_pluginSettings);
                }
            }
            catch (Exception ex)
            {
                //       _logger.Log(ex);
            }


            return(_pluginSettings);
        }
 public void SaveSettings(PluginsSettings settings)
 {
 }
Exemple #10
0
        public static IEnumerable <PluginPair> PythonPlugins(List <PluginMetadata> source, PluginsSettings settings)
        {
            if (!source.Any(o => o.Language.ToUpper() == AllowedLanguage.Python))
            {
                return(new List <PluginPair>());
            }

            if (!string.IsNullOrEmpty(settings.PythonDirectory) && FilesFolders.LocationExists(settings.PythonDirectory))
            {
                return(SetPythonPathForPluginPairs(source, Path.Combine(settings.PythonDirectory, PythonExecutable)));
            }

            var pythonPath = string.Empty;

            if (MessageBox.Show("Flow detected you have installed Python plugins, which " +
                                "will need Python to run. Would you like to download Python? " +
                                Environment.NewLine + Environment.NewLine +
                                "Click no if it's already installed, " +
                                "and you will be prompted to select the folder that contains the Python executable",
                                string.Empty, MessageBoxButtons.YesNo) == DialogResult.No &&
                string.IsNullOrEmpty(settings.PythonDirectory))
            {
                var dlg = new FolderBrowserDialog
                {
                    SelectedPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles)
                };

                var result = dlg.ShowDialog();
                if (result == DialogResult.OK)
                {
                    string pythonDirectory = dlg.SelectedPath;
                    if (!string.IsNullOrEmpty(pythonDirectory))
                    {
                        pythonPath = Path.Combine(pythonDirectory, PythonExecutable);
                        if (File.Exists(pythonPath))
                        {
                            settings.PythonDirectory = pythonDirectory;
                            Constant.PythonPath      = pythonPath;
                        }
                        else
                        {
                            MessageBox.Show("Can't find python in given directory");
                        }
                    }
                }
            }
            else
            {
                var installedPythonDirectory = Path.Combine(DataLocation.DataDirectory(), "PythonEmbeddable");

                // Python 3.8.9 is used for Windows 7 compatibility
                DroplexPackage.Drop(App.python_3_8_9_embeddable, installedPythonDirectory).Wait();

                pythonPath = Path.Combine(installedPythonDirectory, PythonExecutable);
                if (FilesFolders.FileExists(pythonPath))
                {
                    settings.PythonDirectory = installedPythonDirectory;
                    Constant.PythonPath      = pythonPath;
                }
                else
                {
                    Log.Error("PluginsLoader",
                              $"Failed to set Python path after Droplex install, {pythonPath} does not exist",
                              "PythonPlugins");
                }
            }

            if (string.IsNullOrEmpty(settings.PythonDirectory) || string.IsNullOrEmpty(pythonPath))
            {
                MessageBox.Show(
                    "Unable to set Python executable path, please try from Flow's settings (scroll down to the bottom).");
                Log.Error("PluginsLoader",
                          $"Not able to successfully set Python path, the PythonDirectory variable is still an empty string.",
                          "PythonPlugins");

                return(new List <PluginPair>());
            }

            return(SetPythonPathForPluginPairs(source, pythonPath));
        }