示例#1
0
        public MeerkatWindowViewModel(IOpenFileService openFileService, IFolderBrowerService folderBrowerService, IBitTorrentManager bitTorrentManager)
        {
            // store the current dispatcher ref
            currentDispatcher = Dispatcher.CurrentDispatcher;

            this.bitTorrentManager   = bitTorrentManager;
            this.openFileService     = openFileService;
            this.folderBrowerService = folderBrowerService;

            this.AddTorrentCommand                  = new AddTorrentCommand(this);
            this.RemoveTorrentCommand               = new RemoveTorrentCommand(this);
            this.RemoveAndDeleteTorrentCommand      = new RemoveAndDeleteTorrentCommand(this);
            this.OpenContainingFolderCommand        = new OpenContainingFolderCommand(this);
            this.TorrentRecheckCommand              = new TorrentRecheckCommand(this);
            this.AllowUnencryptedConnectionsCommand = new AllowUnencryptedConnectionsCommand(this);
            this.StartTorrentCommand                = new StartTorrentCommand(this);
            this.StopTorrentCommand                 = new StopTorrentCommand(this);
            this.PauseTorrentCommand                = new PauseTorrentCommand(this);

            Torrents = new ObservableCollection <Torrent>();
            Peers    = new ObservableCollection <Peer>();

            bitTorrentManager.TorrentAdded   += OnTorrentAdded;
            bitTorrentManager.TorrentRemoved += OnTorrentRemoved;
        }
示例#2
0
        public RecentlyUsedItemsViewModel(
            IRecentlyUsedItemsService recentlyUsedItemsService,
            IMessageService messageService,
            IProcessService processService,
            IOpenFileService openFileService)
        {
            Argument.IsNotNull(() => recentlyUsedItemsService);
            Argument.IsNotNull(() => messageService);
            Argument.IsNotNull(() => processService);
            Argument.IsNotNull(() => openFileService);

            _recentlyUsedItemsService = recentlyUsedItemsService;
            _messageService           = messageService;
            _processService           = processService;
            _openFileService          = openFileService;

            SettingsCommand  = new RelayCommand(ExecSC, CanSC);
            TutorialsCommand = new RelayCommand(ExecTC, CanTC);
            WikiCommand      = new RelayCommand(ExecWC, CanWC);

            PinItem        = new Command <string>(OnPinItemExecute);
            UnpinItem      = new Command <string>(OnUnpinItemExecute);
            OpenInExplorer = new Command <string>(OnOpenInExplorerExecute);

            recentlyUsedItemsService.Items
            .Connect()
            .ObserveOn(RxApp.MainThreadScheduler)
            .Bind(out _recentlyUsedItems)
            .Subscribe(OnRecentlyUsedItemsChanged);
        }
示例#3
0
        public MainWindowViewModel()
        {
            #region Obtain Services
            try
            {
                messageBoxService = Resolve <IMessageBoxService>();
                openFileService   = Resolve <IOpenFileService>();
            }
            catch
            {
                Logger.Error("Error resolving services");
                throw new ApplicationException("Error resolving services");
            }
            #endregion

            #region Commands

            //New VM Command
            newVMCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => CanExecuteNewVMCommand,
                ExecuteDelegate    = x => ExecuteNewVMCommand()
            };


            //Open VM Command
            openVMCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => CanExecuteOpenVMCommand,
                ExecuteDelegate    = x => ExecuteOpenVMCommand()
            };
            #endregion
        }
 public LoaderViewModel(ILoaderService loaderService, IDbWriterService repository, IOpenFileService openFileSerice)
 {
     _openFileSerice = openFileSerice;
     _loaderService  = loaderService;
     _repository     = repository;
     _repository.DataCopiedPercentage += (sender, args) => { CurrentStep = args.Percentage; };
 }
示例#5
0
        public SettingsViewModel(ISettingsManager settingsManager, IUpdateService updateService, IOpenFileService openFileService)
        {
            Argument.IsNotNull(() => settingsManager);
            Argument.IsNotNull(() => updateService);
            Argument.IsNotNull(() => openFileService);

            _settingsManager = settingsManager;
            _updateService   = updateService;
            _openFileService = openFileService;

            OpenGamePathCommand     = new RelayCommand(ExecuteOpenGamePath, CanOpenGamePath);
            OpenWccPathCommand      = new RelayCommand(ExecuteOpenWccPath, CanOpenWccPath);
            OpenModDirectoryCommand = new RelayCommand(ExecuteOpenMod, CanOpenMod);
            OpenDlcDirectoryCommand = new RelayCommand(ExecuteOpenDlc, CanOpenDlc);

            Title = "Settings";


            CheckForUpdates = _settingsManager.CheckForUpdates;
            ExecutablePath  = _settingsManager.ExecutablePath;
            WccLitePath     = _settingsManager.WccLitePath;
            GameModDir      = _settingsManager.GameModDir;
            GameDlcDir      = _settingsManager.GameDlcDir;

            SetDefaultModDir();
            SetDefaultDlcDir();


            // automatically scan the registry for exe paths for wcc and tw3
            // if either text field is empty
            if (string.IsNullOrEmpty(ExecutablePath) || string.IsNullOrEmpty(WccLitePath))
            {
                exeSearcherSlave_DoWork();
            }
        }
示例#6
0
        public ImageLoaderViewModel(
            IMessageBoxService messageBoxService,
            IOpenFileService openFileService,
            ISaveFileService saveFileService,
            IUIVisualizerService uiVisualizerService,
            IImageProvider imageProvider,
            IImageDiskOperations imageDiskOperations,
            IViewAwareStatus viewAwareStatusService)
        {
            //setup services
            this.messageBoxService                  = messageBoxService;
            this.openFileService                    = openFileService;
            this.saveFileService                    = saveFileService;
            this.uiVisualizerService                = uiVisualizerService;
            this.imageProvider                      = imageProvider;
            this.imageDiskOperations                = imageDiskOperations;
            this.viewAwareStatusService             = viewAwareStatusService;
            this.viewAwareStatusService.ViewLoaded += ViewAwareStatusService_ViewLoaded;

            //commands, SimpleCommand<T1,T2> T1 is CanExecute parameter type, and T2 is Execute type
            AddImageRatingCommand   = new SimpleCommand <Object, Object>(ExecuteAddImageRatingCommand);
            SaveToFileCommand       = new SimpleCommand <Object, Object>(ExecuteSaveToFileCommand);
            OpenExistingFileCommand = new SimpleCommand <Object, Object>(ExecuteOpenExistingFileCommand);

            //EventToCommand triggered, see the View
            ShowActionsCommand = new SimpleCommand <Object, Object>(ExecuteShowActionsCommand);
            HideActionsCommand = new SimpleCommand <Object, Object>(ExecuteHideActionsCommand);

            //some reverse commands, that the VM fires, and the View uses as CompletedAwareCommandTriggers
            //to carry out some actions. In this case GoToStateActions are used in the View
            ShowActionsCommandReversed = new SimpleCommand <Object, Object>((input) => { });
            HideActionsCommandReversed = new SimpleCommand <Object, Object>((input) => { });
        }
示例#7
0
        public void AddTorrentTest()
        {
            // Create our mocks for the torrent manager and the open dialog services

            var btmMock = new Mock <IBitTorrentManager>();

            btmMock.Setup(mock => mock.AddTorrent("my.torrent", @"c:\downloads")).Returns(true);
            IBitTorrentManager bitTorrentManager = btmMock.Object;

            var openFileServiceMock = new Mock <IOpenFileService>();

            openFileServiceMock.Setup(mock => mock.OpenFileDialog()).Returns(true);
            openFileServiceMock.SetupProperty(f => f.FileName, "my.torrent");
            IOpenFileService openFileService = openFileServiceMock.Object;

            var folderBrowserServiceMock = new Mock <IFolderBrowerService>();

            folderBrowserServiceMock.Setup(mock => mock.OpenFolderBrowserDialog()).Returns(true);
            folderBrowserServiceMock.SetupProperty(f => f.FolderName, @"c:\downloads");
            IFolderBrowerService folderBrowserService = folderBrowserServiceMock.Object;

            // Create the vm (not mocked!) and call the function we are testing
            MeerkatWindowViewModel vm = new MeerkatWindowViewModel(openFileService, folderBrowserService, bitTorrentManager);
            bool ret = vm.AddTorrent();

            Assert.AreEqual(true, ret);

            // Verify the BitTorrentManager->AddTorrent & dialog show functions were called & called with the correct values
            openFileServiceMock.Verify(framework => framework.OpenFileDialog());
            folderBrowserServiceMock.Verify(framework => framework.OpenFolderBrowserDialog());
            btmMock.Verify(framework => framework.AddTorrent("my.torrent", @"c:\downloads"));
        }
 public LoadedFilesViewModel(ICoreApplicationService coreService, IOpenFileService openFileService, IFindInFilesService findInFilesService)
     : base()
 {
     _coreService = coreService;
     _openFileService = openFileService;
     _findInFilesService = findInFilesService;
 }
示例#9
0
 public Task3ViewModel(IOpenFileService openFileService,
                       IModelProvider modelProvider,
                       IMessageService messageService)
     : base(openFileService, modelProvider, messageService)
 {
     startCommand = new DelegateCommand(StartRotate);
 }
        /// <summary>
        /// Edit a referenced model.
        /// </summary>
        protected virtual void EditReferencedModel()
        {
            IOpenFileService openFileService = this.GlobalServiceProvider.Resolve <IOpenFileService>();

            openFileService.Filter = FileDialogFilter;
            if (openFileService.ShowDialog(null) == true)
            {
                if (!EnsureClosing())
                {
                    return;
                }

                bool bEnsureOpening;
                using (new Tum.PDE.ToolFramework.Modeling.Visualization.ViewModel.UI.WaitCursor())
                {
                    bEnsureOpening = EnsureOpening(openFileService.FileName);
                }
                if (!bEnsureOpening)
                {
                    return;
                }

                SetReferencedModel(openFileService.FileName);
            }

            OnPropertyChanged("IsReferencedModelSet");
            OnPropertyChanged("PropertyValue");
        }
 public ToolsUpdateLicenseCommandContainer(ICommandManager commandManager, IServiceLocator serviceLocator)
     : base(Commands.Tools.UpdateLicense, commandManager, serviceLocator)
 {
     _openFileService = ServiceLocator.ResolveType <IOpenFileService>();
     _licenseService  = ServiceLocator.ResolveType <ILicenseService>();
     _messageService  = ServiceLocator.ResolveType <IMessageService>();
 }
示例#12
0
        public MainWindowViewModel()
        {
            #region Obtain Services
            try
            {
                messageBoxService = Resolve<IMessageBoxService>();
                openFileService = Resolve<IOpenFileService>();
            }
            catch
            {
                Logger.Error( "Error resolving services");
                throw new ApplicationException("Error resolving services");
            }
            #endregion

            #region Commands

            //New VM Command
            newVMCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => CanExecuteNewVMCommand,
                ExecuteDelegate = x => ExecuteNewVMCommand()
            };


            //Open VM Command
            openVMCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => CanExecuteOpenVMCommand,
                ExecuteDelegate = x => ExecuteOpenVMCommand()
            };
            #endregion


        }
 public Task5ViewModel(IOpenFileService openFileService,
                       IModelProvider modelProvider,
                       IMessageService messageService)
     : base(openFileService, modelProvider, messageService)
 {
     startCommand = new DelegateCommand(Start, () => CanStart);
     stopCommand  = new DelegateCommand(Stop, () => CanStop);
 }
示例#14
0
 public ViewModelFactory(IOpenFileService openFileService,
                         IModelProvider modelProvider,
                         IMessageService messageService)
 {
     this.messageService  = messageService;
     this.modelProvider   = modelProvider;
     this.openFileService = openFileService;
 }
        public CompatibilitySubSettingsView()
        {
            InitializeComponent();

            _settingsManager        = ServiceLocator.Default.ResolveType <ISettingsManager>();
            _openFileService        = ServiceLocator.Default.ResolveType <IOpenFileService>();
            _selectDirectoryService = ServiceLocator.Default.ResolveType <ISelectDirectoryService>();
        }
示例#16
0
 public MainWindowViewModel(IOpenFileService openFileService)
 {
     if (openFileService == null)
     {
         throw new ArgumentNullException("openFileService");
     }
     this.openFileService = openFileService;
 }
示例#17
0
        public VstPluginSettingsViewModel(Plugin plugin, IVstService vstService, IOpenFileService openFileService,
                                          ISelectDirectoryService selectDirectoryService, ILicenseService licenseService,
                                          IAdvancedMessageService messageService,
                                          ICommandManager commandManager,
                                          RemoteVstService remoteVstService,
                                          INativeInstrumentsResourceGeneratorService
                                          resourceGeneratorService)
        {
            Argument.IsNotNull(() => vstService);
            Argument.IsNotNull(() => openFileService);
            Argument.IsNotNull(() => selectDirectoryService);
            Argument.IsNotNull(() => licenseService);
            Argument.IsNotNull(() => resourceGeneratorService);
            Argument.IsNotNull(() => commandManager);

            Plugin = plugin;

            _openFileService          = openFileService;
            _commandManager           = commandManager;
            _selectDirectoryService   = selectDirectoryService;
            _licenseService           = licenseService;
            _vstService               = vstService;
            _resourceGeneratorService = resourceGeneratorService;
            _messageService           = messageService;
            _remoteVstService         = remoteVstService;

            OpenNKSFile               = new TaskCommand(OnOpenNKSFileExecute);
            ClearMappings             = new TaskCommand(OnClearMappingsExecute);
            AddAdditionalPresetFiles  = new TaskCommand(OnAddAdditionalPresetFilesExecute);
            AddAdditionalPresetFolder = new TaskCommand(OnAddAdditionalPresetFolderExecute);
            RemoveAdditionalBankFiles = new Command <object>(OnRemoveAdditionalBankFilesExecute);
            RemoveCategory            = new Command <object>(OnRemoveCategoryExecute);
            AddCategory               = new Command(OnAddCategoryExecute);

            ReplaceVBLogo    = new TaskCommand(OnReplaceVBLogoExecute);
            ReplaceVBArtwork = new TaskCommand(OnReplaceVBArtworkExecute);

            ReplaceMSTLogo    = new TaskCommand(OnReplaceMSTLogoExecute);
            ReplaceMSTArtwork = new TaskCommand(OnReplaceMSTArtworkExecute);
            ReplaceMSTPlugin  = new TaskCommand(OnReplaceMSTPluginExecute);

            ReplaceOSOLogo = new TaskCommand(OnReplaceOSOLogoExecute);

            SubmitResource             = new TaskCommand(OnSubmitResourceExecute);
            QueryOnlineResources       = new TaskCommand(OnQueryOnlineResourcesExecute);
            LoadSelectedOnlineResource = new TaskCommand(OnLoadSelectedOnlineResourceExecute);

            GenerateResources = new TaskCommand(OnGenerateResourcesExecute);


            Title = "Settings for " + Plugin.PluginName;


            GenerateControllerMappingModels();
            PluginLocations = (from pluginLocation in Plugin.PluginLocations
                               where pluginLocation.IsPresent
                               select pluginLocation).ToList();
        }
示例#18
0
 public ShiftImportPresenter(IShiftDispatcherModel shiftDispatcherModel, ICalendarEventModel calendarEventModel, IOpenFileService openFileService)
 {
     _shiftDispatcherModel = shiftDispatcherModel;
     _calendarEventModel = calendarEventModel;
     _openFileService = openFileService;
     _bindableAgents = new List<IEnumerable>();
     _openFileService.Filter = "Excel File|*.xls";
     _assignmentCellConverter = new BlockToCellConverter(Brushes.OrangeRed, "#FF77BB44".ToBrush(1), Brushes.DarkGray).ShowDayOffText(false);
 }
            protected override void OnCompleted(IOpenFileService openFileService, ResultCompletionEventArgs args)
            {
                if (!args.WasCancelled)
                {
                    Result = openFileService.Files;
                }

                base.OnCompleted(openFileService, args);
            }
示例#20
0
        public GameViewModel(IRegionManager regionManager, IEventAggregator eventAggregator, IOpenFileService openFileService, IDataAccess dataAccess) : base(regionManager, eventAggregator)
        {
            _openFileService = openFileService;
            _dataAccess      = dataAccess;

            CloseDialogCommand      = new DelegateCommand <DialogResult?>(CloseDialog);
            OpenFilePickerCommand   = new DelegateCommand(GetSavefilePath);
            OpenFolderPickerCommand = new DelegateCommand(GetBackupFolderPath);
        }
示例#21
0
 public ShiftImportPresenter(IShiftDispatcherModel shiftDispatcherModel, ICalendarEventModel calendarEventModel, IOpenFileService openFileService)
 {
     _shiftDispatcherModel    = shiftDispatcherModel;
     _calendarEventModel      = calendarEventModel;
     _openFileService         = openFileService;
     _bindableAgents          = new List <IEnumerable>();
     _openFileService.Filter  = "Excel File|*.xls";
     _assignmentCellConverter = new BlockToCellConverter(Brushes.OrangeRed, "#FF77BB44".ToBrush(1), Brushes.DarkGray).ShowDayOffText(false);
 }
示例#22
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DataGridViewModel"/> class.
 /// </summary>
 /// <param name="title">The title.</param>
 /// <param name="openFileService">The open file service.</param>
 /// <param name="saveFileService">The save file service.</param>
 /// <param name="uiVisualizerService">The UI visualizer service.</param>
 /// <param name="messageMediator">The message mediator.</param>
 public DataGridViewModel(string title, IOpenFileService openFileService, ISaveFileService saveFileService, IUIVisualizerService uiVisualizerService,
                          IMessageMediator messageMediator, IContextualViewModelManager contextualViewModelManager)
     : this(openFileService, saveFileService, uiVisualizerService, messageMediator, contextualViewModelManager)
 {
     if (!string.IsNullOrWhiteSpace(title))
     {
         Title = title;
     }
 }
示例#23
0
        private void OpenRecentDocument(object file)
        {
            if (file == null)
            {
                return;
            }
            IOpenFileService service = _weakCont.Get().Resolve <IOpenFileService>();

            service.OpenFromID(file as string);
        }
        public OpenFilePickerViewModel(IOpenFileService selectFileService, IProcessService processService)
        {
            Argument.IsNotNull(() => selectFileService);
            Argument.IsNotNull(() => processService);

            _selectFileService = selectFileService;
            _processService = processService;

            OpenDirectory = new Command(OnOpenDirectoryExecute, OnOpenDirectoryCanExecute);
            SelectFile = new Command(OnSelectFileExecute);
        }
        //private LomoConfigViewModel(LomoConfigViewModel lomoConfigViewModel)
        //{
        //    Name = new DataWrapper<string>(this, new PropertyChangedEventArgs("Name"));
        //    Name.DataValue = string.Copy(lomoConfigViewModel.Name.DataValue);
        //    Fields = CloneFields(lomoConfigViewModel.Fields);
        //}

        public LomoConfigViewModel(string name, IOpenFileService openFileService, ICustomerRepository customerRepository)
        {
            this.name = name;
            this.openFileService = openFileService;
            this.customerRepository = customerRepository;

            DisplayName = "la Configuración de Lomo";
            Customers = this.customerRepository.GetAll().Select(customer => new CustomerViewModel { Id = customer.Id, Name = customer.Name });

            SetupDataWrappers();
        }
 public MainViewModel(IOpenFileService openFileService, ISaveFileService saveFileService, IPdfService pdfService, CharacterSheetViewModel characterSheet)
 {
     _openFileService                  = openFileService;
     _saveFileService                  = saveFileService;
     _pdfService                       = pdfService;
     _saveFileService.Filter           = "Pdf File (*.pdf)|*.pdf";
     _saveFileService.Title            = "Salva Scheda Personaggio";
     _saveFileService.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
     _saveFileService.DefaultFileName  = "output.pdf";
     _characterSheet                   = characterSheet;
 }
示例#27
0
        public TaskViewModel(IOpenFileService openFileService,
                             IModelProvider modelProvider,
                             IMessageService messageService)
        {
            this.messageService  = messageService;
            this.modelProvider   = modelProvider;
            this.openFileService = openFileService;

            clearCommand = new DelegateCommand(Clear, () => CanClear);
            loadCommand  = new AsyncDelegateCommand(LoadAsync);
        }
 public ConfigWindowViewModel(ILomoConfigService lomoConfigService, IDefaultFieldsForNewConfigsRepository defaultFieldsRepository, ICustomerRepository customerRepository, IOpenFileService openFileService, IMessageBoxService messageBoxService)
 {
     this.lomoConfigService = lomoConfigService;
     this.defaultFieldsRepository = defaultFieldsRepository;
     this.customerRepository = customerRepository;
     this.openFileService = openFileService;
     this.messageBoxService = messageBoxService;
     Configs =
         new ObservableCollection<LomoConfigViewModel>(
             lomoConfigService.LomoConfigs.Select(config => ModelToViewModelConverter.Convert(config, customerRepository, openFileService)));
 }
        public MainWindowViewModel(IUIVisualizerService uiVisualizerService, IPleaseWaitService pleaseWaitService, IMessageService messageService, IOpenFileService openFileService)
        {
            _uiVisualizerService = uiVisualizerService;
            _pleaseWaitService = pleaseWaitService;
            _messageService = messageService;
            _openFileService = openFileService;

            AddMagnet = new Command(OnAddMagnetExecuteAsync);
            EditMagnet = new Command(OnEditMagnetExecuteAsync, OnEditMagnetCanExecute);
            RemoveMagnet = new Command(OnRemoveMagnetExecuteAsync, OnRemoveMagnetCanExecute);
        }
        public OpenFilePickerViewModel(IOpenFileService selectFileService, IProcessService processService)
        {
            Argument.IsNotNull(() => selectFileService);
            Argument.IsNotNull(() => processService);

            _selectFileService = selectFileService;
            _processService    = processService;

            OpenDirectory = new Command(OnOpenDirectoryExecute, OnOpenDirectoryCanExecute);
            SelectFile    = new TaskCommand(OnSelectFileExecuteAsync);
        }
示例#31
0
 public JobsPickAndRunJarViewModel(
     IMessageBoxService messageBoxService,
     IDatabricksWebApiClient databricksWebApiClient,
     IOpenFileService openFileService,
     IDataBricksFileUploadService dataBricksFileUploadService)
 {
     _messageBoxService           = messageBoxService;
     _databricksWebApiClient      = databricksWebApiClient;
     _openFileService             = openFileService;
     _dataBricksFileUploadService = dataBricksFileUploadService;
     PickInputJarFileCommand      = new SimpleAsyncCommand <object, object>(x => !IsBusy && !_isPolling, ExecutePickInputJarFileCommandAsync);
 }
示例#32
0
        public FileOpenCommandContainer(ICommandManager commandManager, IProjectManager projectManager, IOpenFileService openFileService,
                                        IFileService fileService, IPleaseWaitService pleaseWaitService)
            : base(Commands.File.Open, commandManager, projectManager)
        {
            Argument.IsNotNull(() => openFileService);
            Argument.IsNotNull(() => fileService);
            Argument.IsNotNull(() => pleaseWaitService);

            _openFileService   = openFileService;
            _fileService       = fileService;
            _pleaseWaitService = pleaseWaitService;
        }
 public CalendarEventImportPresenter(Country country, IOpenFileService openFileService, ICalendarEventModel calendarEventModel)
     : base(openFileService)
 {
     _country            = country;
     _calendarEventModel = calendarEventModel;
     _nameOfSheets       = new Dictionary <string, string[]>
     {
         { "calendarevent", new[] { "EventName", "StartDate", "EndDate", "TimeZoneId" } }
     };
     _existEntities  = new List <CalendarEvent>();
     _loadedEntities = new List <ConflictCalendarEvent>(100);
     _hasConflict    = false;
 }
示例#34
0
        public DataGridViewModel(IOpenFileService openFileService, ISaveFileService saveFileService, IUIVisualizerService uiVisualizerService,
                                 IMessageMediator messageMediator)
        {
            Argument.IsNotNull(() => openFileService);
            Argument.IsNotNull(() => saveFileService);
            Argument.IsNotNull(() => uiVisualizerService);
            Argument.IsNotNull(() => messageMediator);

            _openFileService     = openFileService;
            _saveFileService     = saveFileService;
            _uiVisualizerService = uiVisualizerService;
            _messageMediator     = messageMediator;
        }
示例#35
0
        public CommandsService(StudioStateModel model,
            ICommandManager commandManager,
            IMementoService mementoService,
            IMessageService messageService,
            IOpenFileService openFileService,
            IRecentlyUsedItemsService recentlyUsedItemsService,
            ISaveFileService saveFileService,
            IProcessService processService)
        {
            Argument.IsNotNull(() => model);
            Argument.IsNotNull(() => commandManager);
            Argument.IsNotNull(() => mementoService);
            Argument.IsNotNull(() => messageService);
            Argument.IsNotNull(() => openFileService);
            Argument.IsNotNull(() => recentlyUsedItemsService);
            Argument.IsNotNull(() => saveFileService);
            Argument.IsNotNull(() => processService);

            this.model = model;
            this.commandManager = commandManager;
            this.mementoService = mementoService;
            this.messageService = messageService;
            this.openFileService = openFileService;
            this.recentlyUsedItemsService = recentlyUsedItemsService;
            this.saveFileService = saveFileService;
            this.processService = processService;

            this.UndoCommand = new Command(this.Undo, this.CanUndo);
            this.RedoCommand = new Command(this.Redo, this.CanRedo);
            this.OpenProjectCommand = new Command(this.OpenProject, () => true);

            this.SaveProjectAsCommand = new Command(delegate { this.SaveAsProject(); }, () => true);
            this.SaveProjectCommand = new Command(delegate { this.SaveProject(); }, this.CanSave);

            this.OpenRecentlyUsedItemCommand = new Command<string>(this.OnOpenRecentlyUsedItemExecute);

            this.PinItemCommand = new Command<string>(this.PinItem);
            this.UnpinItemCommand = new Command<string>(this.UnpinItem);
            this.OpenInExplorerCommand = new Command<string>(this.OpenInExplorer);

            this.StartCommand = new Command(this.Start, this.CanStart);

            this.ExitCommand = new Command(this.Exit);

            commandManager.RegisterCommand("Script.Open", this.OpenProjectCommand);
            commandManager.RegisterCommand("Script.Save", this.SaveProjectCommand);
            commandManager.RegisterCommand("Script.SaveAs", this.SaveProjectAsCommand);
            commandManager.RegisterCommand("App.Exit", this.ExitCommand);

            this.model.ProjectPropertyChanged += this.OnProjectPropertyChanged;
        }
        public static LomoConfigViewModel Convert(LomoConfig lomoConfig, ICustomerRepository customerRepository, IOpenFileService openFileService)
        {
            var viewModel = new LomoConfigViewModel(lomoConfig.Name, openFileService, customerRepository)
            {
                Id = lomoConfig.Id,
                BoxCount = { DataValue = lomoConfig.BoxCount },
                SelectedCustomer = { DataValue = lomoConfig.Customer != null ? Convert(lomoConfig.Customer) : null },
                Description = { DataValue = lomoConfig.Description },
                ImagePath = { DataValue = lomoConfig.ImagePath },
                Fields = new ObservableCollection<FieldViewModel>(lomoConfig.Fields.Select(Convert)),
            };

            return viewModel;
        }
示例#37
0
        public NKSFViewModel(IOpenFileService openFileService, DeveloperService developerService)
        {
            Argument.IsNotNull(() => openFileService);


            _openFileService  = openFileService;
            _developerService = developerService;


            Title = "NKS Viewer";

            OpenNKSFile       = new TaskCommand(OnOpenNKSFFileExecute);
            OpenWithHexEditor = new TaskCommand(OnOpenWithHexEditorExecute);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SolutionValidatorViewModel"/> class.
        /// </summary>
        public SolutionValidatorViewModel(ISelectDirectoryService selectDirectoryService, IOpenFileService openFileService, ISaveFileService saveFileService)
        {
            Argument.IsNotNull(() => selectDirectoryService);
            Argument.IsNotNull(() => openFileService);

            _selectDirectoryService = selectDirectoryService;
            _openFileService        = openFileService;
            _saveFileService        = saveFileService;

            CreateCommands();

            LoadAppSettings();
            ValidationResults = new ObservableCollection <ValidationMessage>();
            TotalCheckCount   = 0;
        }
 public ViewAllUsersViewViewModel(IMessageBoxService messageBoxService, IViewAwareStatus viewAwareStatus,
     IViewInjectionService viewInjectionService, IUserService userService, IOpenFileService openFileService)
 {
     this.messageBoxService = messageBoxService;
     this.viewAwareStatus = viewAwareStatus;
     this.userService = userService;
     this.viewInjectionService = viewInjectionService;
     this.openFileService = openFileService;
     Mediator.Instance.Register(this);
     //Initialise Commands
     UpdateUserCommand = new SimpleCommand<object, object>(CanExecuteUpdateUserCommand, ExecuteUpdateUserCommand);
     UploadUserImageCommand = new SimpleCommand<object, object>(CanExecuteUploadUserImageCommand,
                                                                ExecuteUploadUserImageCommand);
     viewAwareStatus.ViewLoaded += new Action(viewAwareStatus_ViewLoaded);
 }
示例#40
0
 public MainWindowViewModel(IOpenFileService openFileService)
 {
     _openFileService       = openFileService;
     LoadFileCommand        = new DelegateCommand(LoadFile).ObservesCanExecute(() => CanBrowse);
     LoadDroppedFileCommand = new DelegateCommand <DragEventArgs>(LoadDroppedFile).ObservesCanExecute(() => CanBrowse);
     LoadNewFileCommand     = new DelegateCommand(LoadNewFile).ObservesCanExecute(() => IsFileLoaded);
     OpenLinkCommand        = new DelegateCommand <string>(OpenLink);
     OpenLinkCommand        = new DelegateCommand <string>(OpenLink);
     ShowBannedOnlyCommand  = new DelegateCommand(ShowBannedOnly);
     LookUpInfoCommand      = new DelegateCommand(LookUpInfo);
     SearchCommand          = new DelegateCommand(Search).ObservesCanExecute(() => IsFileLoaded);
     ClearCommand           = new DelegateCommand(Clear).ObservesCanExecute(() => IsFileLoaded);
     // read the csv file line by line, parse and convert to geoip, and finaly add to list
     GeoIPinfoList = File.ReadAllLines(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "IP2LOCATION-LITE.CSV")).Select(v => GeoIPInfo.ParseCSV(v)).ToList(); // no checks for failure, if this fail then the program should
 }
示例#41
0
 public DisplayCollectionViewModel(IChooseFileNameService chooseFileNameService, 
     IOpenFileService openFileService,
     IOpenSimulationService openSimulationService,
     ICanCloseService canCloseService,
     ISaveFileService saveFileService)
 {
     _chooseFileNameService = chooseFileNameService;
     _openFileService = openFileService;
     _openSimulationService = openSimulationService;
     _canCloseService = canCloseService;
     _saveFileService = saveFileService;
     _openFileService.OpenFile += (s, e) => openFile(e.Path, e.Index, e.IndexIsObjectIndex);
     _openSimulationService.OpenSimulation += (s, e) => openSimulation(e.Simulation);
     _canCloseService.CloseMe += (s, e) => Models.Remove(s as ClosableViewModel);
 }
        public MainWindowViewModel(ISaveFileService saveFileService, IOpenFileService openFileService)
        {
            SaveFileService = saveFileService;
            OpenFileService = openFileService;
            GroupCommandArgs = new GroupCommandArgs
            {
                CreateHostingItem = () => new Group()
            };

            LoadCommand = new SimpleCommand<object, object>(o => Load());
            SaveCommand = new SimpleCommand<object, object>(o => Save());

            this.Document = CreateSampleItems();
            this.Recorder = this.Document.QueryInterface<IRecordable>().Recorder;
            this.Recorder.Clear();
        }
        public MainWindowVM(
            IOpenFileService openFileService,
            ISaveFileService saveFileService,
            IExcelImporter excelImporter, 
            IColumnReducer columnReducer,
            IDynamicListGenerator dynamicListGenerator)
        {
            _openFileService = openFileService;
            _saveFileService = saveFileService;
            _excelImporter = excelImporter;
            _columnReducer = columnReducer;
            _dynamicListGenerator = dynamicListGenerator;

            // TODO: Unomment in release!
            OpenExcelSheet("data.xlsx");
        }
        public AddNewUserViewViewModel(IViewAwareStatus viewAwareStatus, IMessageBoxService messageBoxService, IUserService userService, IOpenFileService openFileService)
        {
            this.viewAwareStatus = viewAwareStatus;
            this.messageBoxService = messageBoxService;
            this.userService = userService;
            this.openFileService = openFileService;
            NewUser = new User();
            NewUser.PhotoPath.DataValue = GymSoft.CinchMVVM.Common.GymSoftConfigurationManger.GetDefaultUserPicture().ToString();

            //messageBoxService.ShowInformation(Directory.GetCurrentDirectory());

            //Initialise Commands
            AddNewUserCommand = new SimpleCommand<object, object>(CanAddNewUserCommand, ExecuteAddNewUserCommand);
            CancelAddNewUserCommand = new SimpleCommand<object, object>(ExecuteCancelAddNewUserCommand);
            UploadUserImageCommand = new SimpleCommand<object, object>(CanExecuteUploadUserImageCommand,
                                                                       ExecuteUploadUserImageCommand);
            //this._viewAwareStatus.ViewLoaded += new Action(_viewAwareStatus_ViewLoaded);
        }
示例#45
0
        public RibbonViewModel(INavigationService navigationService, 
            IUIVisualizerService uiVisualizerService,
            ICommandManager commandManager, 
            IRecentlyUsedItemsService recentlyUsedItemsService, 
            IOpenFileService openFileService,
            IMessageService messageService,
            IProcessService processService,
            IFileService fileService)
        {
            Argument.IsNotNull(() => navigationService);
            Argument.IsNotNull(() => uiVisualizerService);
            Argument.IsNotNull(() => commandManager);
            Argument.IsNotNull(() => recentlyUsedItemsService);
            Argument.IsNotNull(() => openFileService);
            Argument.IsNotNull(() => messageService);
            Argument.IsNotNull(() => processService);
            Argument.IsNotNull(() => fileService);

            _navigationService = navigationService;
            _uiVisualizerService = uiVisualizerService;
            _recentlyUsedItemsService = recentlyUsedItemsService;
            _openFileService = openFileService;
            _messageService = messageService;
            _processService = processService;
            _fileService = fileService;

            Help = new Command(OnHelpExecute);
            Open = new Command(this.OnOpenExecute);
            Exit = new Command(OnExitExecute);
            ShowKeyboardMappings = new Command(OnShowKeyboardMappingsExecute);

            OpenRecentlyUsedItem = new Command<string>(OnOpenRecentlyUsedItemExecute);
            UnpinItem = new Command<string>(OnUnpinItemExecute);
            PinItem = new Command<string>(OnPinItemExecute);
            OpenInExplorer = new Command<string>(OnOpenInExplorerExecute);

            OnRecentlyUsedItemsServiceUpdated(null, null);

            commandManager.RegisterCommand("Help.About", Help, this);
            commandManager.RegisterCommand("File.Open", Open, this);
            commandManager.RegisterCommand("File.Exit", Exit, this);
        }
示例#46
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ShellViewModel"/> class.
        /// </summary>
        public ShellViewModel(ILogAnalyzerService logAnalyzerService, IFileWatcherService fileWatcherService, IDispatcherService dispatcherService, 
            IOpenFileService openFileService, IPleaseWaitService pleaseWaitService, IMessageService messageService)
        {
            _logAnalyzerService = logAnalyzerService;
            _fileWatcherService = fileWatcherService;
            _dispatcherService = dispatcherService;
            _openFileService = openFileService;
            _pleaseWaitService = pleaseWaitService;
            _messageService = messageService;

            ParseCommand = new Command(OnParseCommandExecute, OnParseCommandCanExecute);

            LoadFile = new Command<string>(OnLoadFileExecute);

            OpenFileCommand = new Command(OnOpenFileCommandExecute);

            ExitCommand = new Command(OnExitCommandExecute);

            Document = new TextDocument();

            Filter = new LogFilter
                {
                    EnableDebug = true,
                    EnableError = true,
                    EnableInfo = true,
                    EnableWarning = true
                };

            Filter.PropertyChanged += OnFilterPropertyChanged;

            Document.Changed += DocumentChanged;

            _logEntries = new FastObservableCollection<LogEntry>();

            using (var reader = new XmlTextReader("Resources\\HighlightingDefinition.xshd"))
            {
                HighlightingDefinition = HighlightingLoader.Load(reader, HighlightingManager.Instance);
            }

            HighlightingManager.Instance.RegisterHighlighting("CatelHighlighting", new[] { ".cool" }, HighlightingDefinition);
        }
        public TypesViewModel(IOpenFileService openFileService, IPleaseWaitService pleaseWaitService,
            IUIServiceHost uiServiceHost, IReflectionService reflectionService, ICommandManager commandManager)
        {
            Argument.IsNotNull(() => openFileService);
            Argument.IsNotNull(() => pleaseWaitService);
            Argument.IsNotNull(() => uiServiceHost);
            Argument.IsNotNull(() => reflectionService);
            Argument.IsNotNull(() => commandManager);

            _openFileService = openFileService;
            _pleaseWaitService = pleaseWaitService;
            _uiServiceHost = uiServiceHost;
            _reflectionService = reflectionService;

            Assemblies = new List<AssemblyEntry>();

            FileOpen = new Command(OnFileOpenExecute);
            ClearFilter = new Command(OnClearFilterExecute);

            commandManager.RegisterCommand("File.Open", FileOpen, this);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="MainWindowViewModel"/> class.
        /// </summary>
        public MainWindowViewModel(IProjectManager projectManager, IOpenFileService openFileService,
            ISaveFileService saveFileService, IProcessService processService, IMessageService messageService)
        {
            Argument.IsNotNull(() => projectManager);
            Argument.IsNotNull(() => openFileService);
            Argument.IsNotNull(() => saveFileService);
            Argument.IsNotNull(() => processService);

            _projectManager = projectManager;
            _openFileService = openFileService;
            _saveFileService = saveFileService;
            _processService = processService;
            _messageService = messageService;

            LoadProject = new TaskCommand(OnLoadProjectExecuteAsync);
            RefreshProject = new TaskCommand(OnRefreshProjectExecuteAsync, OnRefreshProjectCanExecute);
            SaveProject = new TaskCommand(OnSaveProjectExecuteAsync, OnSaveProjectCanExecute);
            SaveProjectAs = new TaskCommand(OnSaveProjectAsExecuteAsync, OnSaveProjectAsCanExecute);
            CloseProject = new Command(OnCloseProjectExecute, OnCloseProjectCanExecute);
            OpenFile = new Command(OnOpenFileExecute, OnOpenFileCanExecute);
        }
示例#49
0
        public IrpObjectViewModel(ICoreApplicationService coreService, IOpenFileService openFileService, IOpenSimulationService openSimulationService)
            : base()
        {
            _coreService = coreService;
            _openFileService = openFileService;
            _openSimulationService = openSimulationService;

            _containers.Add(_scripts = new IrpObjectContainer("Scripts", _coreService.Scripts));
            _containers.Add(_scenarios = new IrpObjectContainer("Scenarios", _coreService.Scenarios));
            _containers.Add(new IrpVariableContainer("Aggregates", _coreService.AggregateVariables));
            _containers.Add(new IrpVariableContainer("Supply", _coreService.SupplyVariables));
            _containers.Add(new IrpVariableContainer("Demand", _coreService.DemandVariables));
            _containers.Add(new IrpVariableContainer("Storage", _coreService.StorageVariables));
            _containers.Add(new IrpVariableContainer("Cost", _coreService.CostVariables));
            _containers.Add(new IrpVariableContainer("Variables", _coreService.Variables));
            //_containers.Add(new IrpVariableContainer("System", _coreService.SystemVariables));
            _containers.Add(new IrpObjectContainer("Definitions", _coreService.Definitions));
            _containers.Add(new IrpObjectContainer("Categories", _coreService.Categories));
            //_containers.Add(new IrpObjectContainer("Options", _coreService.Options));
            _containers.Add(new IrpObjectContainer("Simulations", _coreService.Simulations));
        }
示例#50
0
        public MainWindow()
        {
            /* init class members */
            _model = _factory.CreateMainModel();
            _ofs = _factory.CreateOpenFileService();

            /* init the WPF framework*/
            InitializeComponent();

            /* set data bundings*/
            base.DataContext = _model;
            this.statusBar.DataContext = _model;

            /*
                here's a temporary example how to add column dynamicly
                this needs to move to the appropriate initializer
            */
            DataGridTextColumn sampleColumn = new DataGridTextColumn();
            sampleColumn.Header = "First Column";
            sampleColumn.Binding = new Binding("FirstColumn");
            this.dataGrid.Columns.Add(sampleColumn);
        }
        public ReferencedAssembliesViewModel()
        {
            #region Commands

            //AddNewPropertyTypeCommand
            addNewAssemblyCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => CanExecuteAddNewAssemblyCommand,
                ExecuteDelegate = x => ExecuteAddNewAssemblyCommand()
            };

            //RemovePropertyTypeCommand
            removeAssemblyCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => CanExecuteRemoveAssemblyCommand,
                ExecuteDelegate = x => ExecuteRemoveAssemblyCommand()
            };
            #endregion

            #region Obtain Services
            try
            {
                messageBoxService = Resolve<IMessageBoxService>();
                uiVisualizerService = Resolve<IUIVisualizerService>();
                openFileService = Resolve<IOpenFileService>();
            }
            catch
            {
                Logger.Error( "Error resolving services");
                throw new ApplicationException("Error resolving services");
            }
            #endregion

            referencedAssemblies = new ObservableCollection<FileInfo>();
            referencedAssembliesCV = CollectionViewSource.GetDefaultView(referencedAssemblies);
            referencedAssembliesCV.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Ascending));

        }
示例#52
0
 public AllFileHandler(IUnityContainer container, ILoggerService loggerService, IOpenFileService openFileService)
 {
     _container = container;
     _loggerService = loggerService;
     _fileService = openFileService;
 }