Ejemplo n.º 1
0
        public AddSystemDialogViewModel(IDialogCoordinator dialogService, CustomDialog callingDialog, IHyperspinManager manager,
                                        IEventAggregator ea, IFileDialogHelper fileFolderServic, ISettingsHypermint settings, ISelectedService service)
        {
            _dialogService    = dialogService;
            _hyperspinManager = manager;
            _callingDialog    = callingDialog;
            _eventAggregator  = ea;
            _fileFolderServic = fileFolderServic;
            _settings         = settings;
            _service          = service;

            CloseDialogCommand = new DelegateCommand(async() =>
            {
                await _dialogService.HideMetroDialogAsync(this, callingDialog);
            });

            SelectDatabaseCommand = new DelegateCommand(() =>
            {
                OnSelectDatabase();
            });

            SaveNewSystemCommand = new DelegateCommand(() =>
            {
                OnSaveNewSystem();
            });
        }
        public MultiSystemViewModel(IEventAggregator ea, IFileDialogHelper fileService,
                                    IDialogCoordinator dialogService, IHyperspinManager hyperspinManager,
                                    ISettingsHypermint settings, ISelectedService selectedService, ILoggerFacade loggerFacade) : base(loggerFacade)
        {
            _eventAggregator   = ea;
            _fileFolderService = fileService;
            _settingsService   = settings;
            _dialogService     = dialogService;
            _hyperspinManager  = hyperspinManager;
            _selectedService   = selectedService;

            MultiSystemList = new ListCollectionView(_hyperspinManager.MultiSystemGamesList);

            _eventAggregator.GetEvent <AddToMultiSystemEvent>().Subscribe(AddToMultiSystem);
            _eventAggregator.GetEvent <BuildMultiSystemEvent>().Subscribe((x) => OpenBuildMultiSystemDialog());
            _eventAggregator.GetEvent <ScanMultiSystemFavoritesEvent>().Subscribe(async(x) => await ScanFavoritesAsync());

            //Commands
            RemoveGameCommand = new DelegateCommand <GameItemViewModel>(RemoveFromMultisystemList);

            //OpenSearchCommand = new DelegateCommand<string>(async x =>
            //{
            //    await RunCustomDialog();
            //});

            //Used for the save dialog
            CloseCommand = new DelegateCommand(async() =>
            {
                await _dialogService.HideMetroDialogAsync(this, customDialog);
            });

            SelectionChanged = new DelegateCommand <IList>(items => { OnMultipleItemsSelectionChanged(items); });
        }
Ejemplo n.º 3
0
 public DocumentController(IWarningViewHelper warningViewHelper, IFileSystem fileSystem, IFileDialogHelper fileDialogHelper, ITextViewHelper textView, Document model)
 {
     m_FileDialogHelper = fileDialogHelper;
     m_FileSystem = fileSystem;
     m_textView = textView;
     m_textView.BufferChanged += HandleM_textViewBufferChanged;
     m_model = model;
     m_model.DocumentChanged += HandleM_modelDocumentChanged;
     m_WarningViewHelper = warningViewHelper;
     m_WarningViewHelper.WarningActivated += HandleM_WarningViewHelperWarningActivated;
 }
Ejemplo n.º 4
0
 public DocumentController(IWarningViewHelper warningViewHelper, IFileSystem fileSystem, IFileDialogHelper fileDialogHelper, ITextViewHelper textView, Document model)
 {
     m_FileDialogHelper        = fileDialogHelper;
     m_FileSystem              = fileSystem;
     m_textView                = textView;
     m_textView.BufferChanged += HandleM_textViewBufferChanged;
     m_model = model;
     m_model.DocumentChanged += HandleM_modelDocumentChanged;
     m_WarningViewHelper      = warningViewHelper;
     m_WarningViewHelper.WarningActivated += HandleM_WarningViewHelperWarningActivated;
 }
Ejemplo n.º 5
0
        public void Setup()
        {
            m_Mockery = new Mockery();
            m_Document = new Document();
            m_TextViewHelper = m_Mockery.NewMock<ITextViewHelper>();
            m_FileSystem = m_Mockery.NewMock<IFileSystem>();
            m_FileDialogHelper = m_Mockery.NewMock<IFileDialogHelper>();
            m_WarningViewHelper = m_Mockery.NewMock<IWarningViewHelper>();

            Expect.Once.On(m_TextViewHelper).EventAdd("BufferChanged", Is.Anything);
            Expect.Once.On(m_WarningViewHelper).EventAdd("WarningActivated", Is.Anything);
            m_DocumentController = new DocumentController(m_WarningViewHelper, m_FileSystem, m_FileDialogHelper, m_TextViewHelper, m_Document);
        }
        public SettingsFlyoutViewModel(IFileDialogHelper findDir, ISettingsHypermint settings)
        {
            _hyperMintSettings = settings;
            _fileFolderService = findDir;

            HyperMintSettings = _hyperMintSettings.HypermintSettings;

            //set the ui theme
            CurrentThemeColor = Properties.Settings.Default.GuiColor;
            IsDarkTheme       = Properties.Settings.Default.GuiTheme;

            //Setup themes for combobox binding
            GuiThemes = new ObservableCollection <string>(MahAppTheme.AvailableThemes);

            //setup commands
            SaveSettings = new DelegateCommand(SaveUiSettings);
            FindPath     = new DelegateCommand <string>(LocatePath);
        }
        public SidebarOptionsViewModel(IHyperspinManager hyperSpinManager,
                                       IHyperspinXmlDataProvider dataProvider, ISelectedService selected, ISettingsHypermint settings,
                                       IEventAggregator ea, IDialogCoordinator dialogService, IFileDialogHelper fileFolderServic)
        {
            _hyperSpinManager = hyperSpinManager;
            _dataProvider     = dataProvider;
            _dialogService    = dialogService;
            _eventAggregator  = ea;
            _selected         = selected;
            _fileFolderServic = fileFolderServic;
            _settings         = settings;

            AddSystemCommand = new DelegateCommand <string>(async x =>
            {
                await OnAddSystem();
            });

            SaveMainMenuCommand = new DelegateCommand(async() => await SaveMainMenu());
        }
        public SaveMultiSystemViewModel(IDialogCoordinator dialogService, CustomDialog customDialog, IEventAggregator ea,
                                        ISettingsHypermint settingsService, IHyperspinManager hyperspinManager, IFileDialogHelper fileService,
                                        ISelectedService selected, ILoggerFacade loggerFacade) : base(loggerFacade)
        {
            _dialogService     = dialogService;
            _customDialog      = customDialog;
            _eventAggregator   = ea;
            _settingsService   = settingsService;
            _fileFolderService = fileService;
            _hyperspinManager  = hyperspinManager;

            CloseCommand = new DelegateCommand(async() =>
            {
                await _dialogService.HideMetroDialogAsync(this, _customDialog);
            });

            SelectSettingsCommand = new DelegateCommand(SelectSettings);

            BuildMultiSystemCommand = new DelegateCommand(async() =>
            {
                try
                {
                    if (CheckValid())
                    {
                        await BuildMultiSystemAsync();

                        Log("Saving MS to xmls");
                        await _hyperspinManager.SaveCurrentSystemsListToXmlAsync(selected.CurrentMainMenu, true);

                        Log("Completed");
                        await _dialogService.HideMetroDialogAsync(this, _customDialog);
                    }
                }
                catch (Exception ex)
                {
                    Log(ex.Message, Category.Warn);
                    await _dialogService.HideMetroDialogAsync(this, _customDialog);
                }
            }
                                                          );
        }
Ejemplo n.º 9
0
        public TextWheelViewModel(ITextImageService textImageService, IEventAggregator eventAggregator, ISettingsHypermint settings, IFileDialogHelper findDir)
        {
            _eventAgg          = eventAggregator;
            _settingsRepo      = settings;
            _fileFolderService = findDir;
            _textImageService  = textImageService;

            GravityOptions = Enum.GetNames(typeof(Gravity));

            SelectFontCommand = new DelegateCommand(SelectFont);

            SavePresetCommand = new DelegateCommand(SavePreset);

            GeneratePreviewCommand = new DelegateCommand(GeneratePreview);

            SelectFontLocalCommand = new DelegateCommand(() =>
            {
                var fontDir = Path.Combine(_settingsRepo.HypermintSettings.RlMediaPath, "Fonts");

                string result = "";

                if (Directory.Exists(fontDir))
                {
                    result = _fileFolderService.SetFileDialog(fontDir);
                }
                else
                {
                    result = _fileFolderService.SetFileDialog();
                }

                CurrentWheelSetting.FontName = result;
                FontName = result;
            });

            GetPresets();
        }