Ejemplo n.º 1
0
        public MessageBoxResult ShowSaveDialog()
        {
            _view = CustomContainer.GetInstancePerRequestType <IRequestServiceNameView>();

            SingleEnvironmentExplorerViewModel = new SingleEnvironmentExplorerViewModel(_environmentViewModel, Guid.Empty, false);
            SingleEnvironmentExplorerViewModel.PropertyChanged += SingleEnvironmentExplorerViewModelPropertyChanged;
            SingleEnvironmentExplorerViewModel.SearchText       = string.Empty;

            try
            {
                if (!string.IsNullOrEmpty(_selectedPath))
                {
                    _environmentViewModel.SelectItem(_selectedPath, b =>
                    {
                        _environmentViewModel.SelectAction(b);
                        b.IsSelected = true;
                    });
                }
                _environmentViewModel.IsSaveDialog = true;
                _environmentViewModel.Children?.Flatten(model => model.Children).Apply(model => model.IsSaveDialog = true);
            }
            catch (Exception)
            {
                //
            }

            HasLoaded = true;
            ValidateName();
            _view.DataContext = this;
            _view.ShowView();

            UpdateEnvironment();

            return(ViewResult);
        }
Ejemplo n.º 2
0
 public IDllListingModel GetGacDLL()
 {
     SelectedDll  = null;
     AssemblyName = string.Empty;
     SearchTerm   = string.Empty;
     PerformLoadAll();
     if (AllDllListingModels != null && AllDllListingModels.Count > 1)
     {
         DllListingModels = new List <IDllListingModel> {
             AllDllListingModels[1]
         };
     }
     if (DllListingModels != null)
     {
         foreach (var dllListingModel in DllListingModels.Where(model => model.ChildrenCount > 0))
         {
             dllListingModel.IsExpanded = true;
         }
     }
     FilterTooltip = Resources.Languages.Tooltips.ManagePluginSourceFilterGACTooltip;
     FilesTooltip  = Resources.Languages.Tooltips.ManagePluginSourceFilesGACTooltip;
     SelectTooltip = Resources.Languages.Tooltips.ManagePluginSourceSelectGACTooltip;
     _view         = CustomContainer.GetInstancePerRequestType <IChooseDLLView>();
     _view.ShowView(this);
     return(SelectedDll);
 }
        /// <exception cref="Exception">A delegate callback throws an exception.</exception>
        public ManagePluginSourceViewModel(IManagePluginSourceModel updateManager, IEventAggregator aggregator, IAsyncWorker asyncWorker)
            : base("PluginSource")
        {
            VerifyArgument.IsNotNull("asyncWorker", asyncWorker);
            VerifyArgument.IsNotNull("updateManager", updateManager);
            VerifyArgument.IsNotNull("aggregator", aggregator);
            _updateManager             = updateManager;
            DllChooser                 = new DLLChooser(updateManager);
            HeaderText                 = Resources.Languages.Core.PluginSourceNewHeaderLabel;
            Header                     = Resources.Languages.Core.PluginSourceNewHeaderLabel;
            OkCommand                  = new DelegateCommand(o => Save(), o => CanSave());
            FileSystemAssemblyName     = string.Empty;
            ConfigFilePath             = string.Empty;
            GACAssemblyName            = string.Empty;
            ChooseFileSystemDLLCommand = new DelegateCommand(o =>
            {
                var dll = DllChooser.GetFileSystemDLL();
                if (dll != null)
                {
                    FileSystemAssemblyName = dll.FullName;
                }
            });
            ChooseGACDLLCommand = new DelegateCommand(o =>
            {
                var dll = DllChooser.GetGacDLL();
                if (dll != null)
                {
                    GACAssemblyName = dll.FullName;
                }
            });

            ChooseConfigFileCommand = new DelegateCommand(o =>
            {
                var fileChooser = CustomContainer.GetInstancePerRequestType <IFileChooserView>();
                fileChooser.ShowView(false);
                var vm = fileChooser.DataContext as FileChooser;
                if (vm != null && vm.Result == MessageBoxResult.OK)
                {
                    var selectedFiles = vm.GetAttachments();
                    if (selectedFiles != null && selectedFiles.Count > 0)
                    {
                        ConfigFilePath = selectedFiles[0];
                    }
                }
            });

            CancelCommand = new DelegateCommand(o => CloseAction.Invoke());

            _warewolfserverName = updateManager.ServerName;
        }
Ejemplo n.º 4
0
 public IDllListingModel GetFileSystemDLL()
 {
     SelectedDll  = null;
     AssemblyName = string.Empty;
     SearchTerm   = string.Empty;
     PerformLoadAll();
     if (AllDllListingModels != null && AllDllListingModels.Count > 1)
     {
         DllListingModels = AllDllListingModels[0].Children.ToList();
     }
     FilterTooltip = Resources.Languages.Tooltips.ManagePluginSourceFilterAssemblyTooltip;
     FilesTooltip  = Resources.Languages.Tooltips.ManagePluginSourceFilesAssemblyTooltip;
     SelectTooltip = Resources.Languages.Tooltips.ManagePluginSourceSelectAssemblyTooltip;
     _view         = CustomContainer.GetInstancePerRequestType <IChooseDLLView>();
     _view.ShowView(this);
     return(SelectedDll);
 }
Ejemplo n.º 5
0
        public MessageBoxResult ShowSaveDialog()
        {
            _view = CustomContainer.GetInstancePerRequestType <IRequestServiceNameView>();

            SingleEnvironmentExplorerViewModel = new SingleEnvironmentExplorerViewModel(_environmentViewModel,
                                                                                        Guid.Empty, false);
            SingleEnvironmentExplorerViewModel.PropertyChanged += SingleEnvironmentExplorerViewModelPropertyChanged;
            SingleEnvironmentExplorerViewModel.SearchText       = string.Empty;

            try
            {
                if (!string.IsNullOrEmpty(_selectedPath))
                {
                    _environmentViewModel.SelectItem(_selectedPath, b =>
                    {
                        _environmentViewModel.SelectAction(b);
                        b.IsSelected = true;
                    });
                }
                _environmentViewModel.IsSaveDialog = true;
                _environmentViewModel.Children?.Flatten(model => model.Children)
                .Apply(model => model.IsSaveDialog = true);
            }
            catch (Exception)
            {
                //
            }

            HasLoaded = true;
            ValidateName();
            _view.DataContext = this;
            _view.ShowView();

            _environmentViewModel.Filter(string.Empty);
            _environmentViewModel.IsSaveDialog = false;
            _environmentViewModel.Children?.Flatten(model => model.Children)
            .Apply(model => model.IsSaveDialog = false);

            var windowsGroupPermission = _environmentViewModel.Server?.Permissions?[0];

            if (windowsGroupPermission != null)
            {
                _environmentViewModel.SetPropertiesForDialogFromPermissions(windowsGroupPermission);
            }

            var permissions = _environmentViewModel.Server?.GetPermissions(_environmentViewModel.ResourceId);

            if (permissions != null)
            {
                if (_environmentViewModel.Children != null)
                {
                    foreach (var explorerItemViewModel in _environmentViewModel.Children.Flatten(model => model.Children))
                    {
                        explorerItemViewModel.SetPermissions((Permissions)permissions);
                    }
                }
            }

            var mainViewModel = CustomContainer.Get <IShellViewModel>();

            if (mainViewModel?.ExplorerViewModel != null)
            {
                mainViewModel.ExplorerViewModel.SearchText = string.Empty;
            }
            return(ViewResult);
        }