public TreeGeneratorInteraction(ISettingsDialogCoordinator dialogCoordinator, IPersistentData persistentData,
            SkillTree skillTree)
        {
            _persistentData = persistentData;
            _dialogCoordinator = dialogCoordinator;
            SkillTree = skillTree;

            OpenTreeGeneratorCommand = new AsyncRelayCommand(OpenTreeGenerator);
            RunTaggedNodesCommand = new AsyncRelayCommand(RunTaggedNodes);
            RunAdvancedCommand = new AsyncRelayCommand(RunAdvanced);
        }
	    private MainViewModel()
	    {
            _serverUri = Property.New(this, p => p.ServerUri, OnPropertyChanged);
            _projectName = Property.New(this, p => p.ProjectName, OnPropertyChanged);
            _status = Property.New(this, p => p.Status, OnPropertyChanged);
	        _connectionIsUp = Property.New(this, p => p.IsConnected, OnPropertyChanged);

            RefreshCommand = new AsyncRelayCommand(Refresh);
            CloseCommand = new RelayCommand(Close);

            PropertyChanged += OnPropertyChanged;
	    }
Example #3
0
 public SwaggerInputViewModel()
 {
     LoadSwaggerUrlCommand = new AsyncRelayCommand <string>(async url => await LoadSwaggerUrlAsync(url));
 }
        /// <summary>
        /// Default constructor for a specific game
        /// </summary>
        /// <param name="game">The DosBox game</param>
        /// <param name="gameType">The type of game</param>
        protected BaseDosBoxConfigViewModel(Games game, GameType gameType)
        {
            Game     = game;
            GameType = gameType;

            // Create the async lock
            AsyncLock = new AsyncLock();

            // Create the commands
            SaveCommand           = new AsyncRelayCommand(SaveAsync);
            UseRecommendedCommand = new RelayCommand(UseRecommended);

            // Set up the available resolution values
            AvailableResolutionValues = new ObservableCollection <string>();

            const double ratio     = 16d / 10d;
            const int    minHeight = 200;
            double       maxHeight = SystemParameters.PrimaryScreenHeight;

            AvailableResolutionValues.Add($"Original");

            for (int height = minHeight; height <= maxHeight; height += minHeight)
            {
                AvailableResolutionValues.Add($"{height * ratio}x{height}");
            }

            // NOTE: Below options are not localized

            // Set available DosBox outputs
            AvailableDosBoxOutputs = new string[]
            {
                "default",
                "surface",
                "overlay",
                "opengl",
                "openglnb",
                "ddraw"
            };

            // Set available DosBox scalers
            AvailableDosBoxScalers = new string[]
            {
                "default",
                "none",
                "normal2x",
                "normal3x",
                "advmame2x",
                "advmame3x",
                "hq2x",
                "hq3x",
                "2xsai",
                "super2xsai",
                "supereagle",
                "advinterp2x",
                "advinterp3x",
                "tv2x",
                "tv3x",
                "rgb2x",
                "rgb3x",
                "scan2x",
                "scan3x"
            };

            // Set available DosBox core modes
            AvailableDosBoxCoreModes = new string[]
            {
                "default",
                "normal",
                "simple",
                "dynamic",
                "auto"
            };

            // Set available DosBox cycle modes
            AvailableDosBoxCycleModes = new string[]
            {
                "default",
                "auto",
                "max"
            };
        }
 public ViewModel()
 {
     AsyncCommand = new AsyncRelayCommand(Execute, CanExecute);
 }
Example #6
0
 /// <summary>Initializes a new instance of the <see cref="WebApiToSwaggerGeneratorViewModel"/> class.</summary>
 public AspNetCoreToSwaggerGeneratorViewModel()
 {
     BrowseAssemblyCommand = new AsyncRelayCommand(BrowseAssembly);
 }
        /// <summary>
        /// Creates a new <see cref="SubredditWidgetViewModel"/> instance.
        /// </summary>
        public SubredditWidgetViewModel()
        {
            LoadPostsCommand = new AsyncRelayCommand(LoadPostsAsync);

            selectedSubreddit = SettingsService.GetValue <string>(nameof(SelectedSubreddit)) ?? Subreddits[0];
        }
Example #8
0
 public EditDataServiceTargetViewModel(IObjectDatabase <IDataServiceTarget> dataServiceTargetDatabase)
 {
     this.dataServiceTargetDatabase = dataServiceTargetDatabase;
     SaveCommand = new AsyncRelayCommand(Save, CanSave);
 }
 public CommitsManagementPresenter(CollectionRepository <Book> repo)
 {
     _repository = repo;
     _hostServer = new AsyncRelayCommand <object>(HostServer, _ => true);
 }
Example #10
0
 public RemoteControlPresenter(WebSocketRemoteWithWorkSpace <CollectionWorkSpace <string> > remote)
 {
     _detach = new AsyncRelayCommand <object>(Detach, _ => true);
     Remote  = remote;
 }
Example #11
0
 public ContentPageViewModel(INavigationService navigationService)
 {
     _navigationService  = navigationService;
     NavigateNextCommand = new AsyncRelayCommand(OnNavigateNext);
     GoBackCommand       = new RelayCommand(OnGoBack);
 }
 public Utility_RaymanDesigner_CreateConfig_ViewModel()
 {
     // Create commands
     CreateConfigCommand = new AsyncRelayCommand(CreateConfigAsync);
 }
Example #13
0
 public PackageViewModel()
 {
     ViewPackageCommand = new AsyncRelayCommand <object>(ViewPackage);
     RefreshCommand     = new AsyncRelayCommand(Refresh);
 }
 public RestrictionOptionsViewModel()
 {
     LoadPresetCommand = new AsyncRelayCommand(LoadPreset, () => DialogState == RestrictionOptionsDialogState.ActiveSimulation);
     SavePresetCommand = new AsyncRelayCommand(SavePreset, () => DialogState == RestrictionOptionsDialogState.ActiveSimulation);
 }
Example #15
0
        public SteamSelectorViewModel(IEventAggregator eventAggregator, ITileCreator tileCreator)
        {
            _tileDataSelectedEvent = eventAggregator.GetEvent <TileDataSelectedEvent>();
            _tileDataSelectedEvent.Subscribe(o =>
            {
                try
                {
                    _reactingToTileDataSelectedEvent = true;
                    SelectedGameData = o as GameDataViewModel;
                }
                finally
                {
                    _reactingToTileDataSelectedEvent = false;
                }
            });
            _tileCreator = tileCreator;

            RefreshCommand = new AsyncRelayCommand(() => Refresh(), null, true);


            UserData = CacheManager.LoadFromCache <UserData>().FirstOrDefault() ?? new UserData();
            SteamAPI = new SteamAPI(UserData.SteamCommunityId);


            UserData.SteamCommunityIdChanged += async(o, e) =>
            {
                await UserData.SaveToCacheAsync();

                SteamAPI = new SteamAPI(UserData.SteamCommunityId);
            };



            var cachedGameDatas = CacheManager.LoadFromCache <GameData>()
                                  .OrderBy(o => o.IsInstalled ? 0 : 1)
                                  .ThenBy(o => o.Name)
                                  .Select(o => new GameDataViewModel(o, _tileCreator, SteamAPI));

            GameDatas.AddRange(cachedGameDatas);

            GameDatas.CollectionChanged += async(o, e) =>
            {
                switch (e.Action)
                {
                case NotifyCollectionChangedAction.Add:

                    foreach (GameData item in e.NewItems)
                    {
                        await item.SaveToCacheAsync();
                    }
                    break;

                case NotifyCollectionChangedAction.Remove:
                    foreach (GameData item in e.OldItems)
                    {
                        await item.RemoveFromCacheAsync();
                    }
                    break;

                default:
                    break;
                }
            };


            Application.Current.Exit += (o, e) =>
            {
                UserData.SaveToCache();
                if (SelectedGameData != null)
                {
                    SelectedGameData.GameModel.SaveToCache();
                }
            };
        }
 public void CanExecute_ConditionIsFalse_FalseReturned()
 {
     var command = new AsyncRelayCommand(() => null, () => false);
     NUnit.Framework.Assert.IsFalse(command.CanExecute(null));
 }
Example #17
0
 public void ConstructorFail()
 {
     _ = new AsyncRelayCommand(null, async(t) => { });
 }
Example #18
0
        public MyAppsViewModel()
        {
            ViewAppCommand = new AsyncRelayCommand(ViewAppAsync);

            WeakReferenceMessenger.Default.Send(new SetPageHeaderMessage("My Apps"));
        }
 public AnnouncementsViewModel()
 {
     LoadAnnouncementsCommand = new AsyncRelayCommand(LoadAnnouncementsAsync);
     OpenAnnouncementCommand  = new AsyncRelayCommand(OpenAnnouncementAsync);
 }
 /// <summary>
 /// Default constructor
 /// </summary>
 protected BaseUbiArtLocalizationConverterUtilityViewModel()
 {
     ExportToJSONCommand = new AsyncRelayCommand(ExportToJSONAsync);
     ImportToLocCommand  = new AsyncRelayCommand(ImportToLocAsync);
 }
        public TerminalViewModel(ISettingsService settingsService, ITrayProcessCommunicationService trayProcessCommunicationService, IDialogService dialogService,
                                 IKeyboardCommandService keyboardCommandService, ApplicationSettings applicationSettings, ShellProfile shellProfile,
                                 IApplicationView applicationView, IClipboardService clipboardService, string terminalState = null)
        {
            SettingsService = settingsService;

            _terminalOptions = SettingsService.GetTerminalOptions();

            TrayProcessCommunicationService = trayProcessCommunicationService;

            DialogService           = dialogService;
            _keyboardCommandService = keyboardCommandService;
            ApplicationSettings     = applicationSettings;
            ApplicationView         = applicationView;
            ClipboardService        = clipboardService;

            ShellProfile  = shellProfile;
            TerminalTheme = shellProfile.TerminalThemeId == Guid.Empty ? SettingsService.GetCurrentTheme() : SettingsService.GetTheme(shellProfile.TerminalThemeId);

            TabThemes               = new ObservableCollection <TabThemeViewModel>(SettingsService.GetTabThemes().Select(theme => new TabThemeViewModel(theme, this)));
            CloseCommand            = new AsyncRelayCommand(TryCloseAsync, CanExecuteCommand);
            CloseLeftTabsCommand    = new RelayCommand(CloseLeftTabs, CanExecuteCommand);
            CloseRightTabsCommand   = new RelayCommand(CloseRightTabs, CanExecuteCommand);
            CloseOtherTabsCommand   = new RelayCommand(CloseOtherTabs, CanExecuteCommand);
            FindNextCommand         = new RelayCommand(FindNext, CanExecuteCommand);
            FindPreviousCommand     = new RelayCommand(FindPrevious, CanExecuteCommand);
            CloseSearchPanelCommand = new RelayCommand(CloseSearchPanel, CanExecuteCommand);
            EditTitleCommand        = new AsyncRelayCommand(EditTitleAsync, CanExecuteCommand);
            DuplicateTabCommand     = new RelayCommand(DuplicateTab, CanExecuteCommand);
            ReconnectTabCommand     = new AsyncRelayCommand(ReconnectTabAsync, () => CanExecuteCommand() && HasExitedWithError);
            CopyCommand             = new AsyncRelayCommand(Copy, () => HasSelection);
            PasteCommand            = new AsyncRelayCommand(Paste);
            CopyLinkCommand         = new AsyncRelayCommand(() => CopyTextAsync(HoveredUri), () => !string.IsNullOrWhiteSpace(HoveredUri));
            ShowSearchPanelCommand  = new RelayCommand(() => ShowSearchPanel = true, () => !ShowSearchPanel);

            FontSize = _terminalOptions.FontSize;

            if (!string.IsNullOrEmpty(terminalState))
            {
                Restore(terminalState);
            }
            else
            {
                var defaultTabTheme = TabThemes.FirstOrDefault(t => t.Theme.Id == ShellProfile.TabThemeId);
                defaultTabTheme.IsSelected = true;
            }

            _transparentTabThemeViewModel = TabThemes.FirstOrDefault(t => t.Theme.Id == 0);

            Terminal = new Terminal(TrayProcessCommunicationService, _terminalId);
            Terminal.KeyboardCommandReceived += Terminal_KeyboardCommandReceived;
            Terminal.OutputReceived          += Terminal_OutputReceived;
            Terminal.SizeChanged             += Terminal_SizeChanged;
            Terminal.TitleChanged            += Terminal_TitleChanged;
            Terminal.Exited += Terminal_Exited;
            Terminal.Closed += Terminal_Closed;

            ContextMenu    = BuidContextMenu();
            TabContextMenu = BuildTabContextMenu();

            WeakReferenceMessenger.Default.RegisterAll(this);
        }
Example #22
0
 public SignInViewModel()
 {
     SignInCommand = new AsyncRelayCommand(SignInAsync);
     SignUpCommand = new AsyncRelayCommand(SignUpAsync);
 }
 public SamplePageViewModel()
 {
     LoadDocsCommand = new AsyncRelayCommand <string>(LoadDocsAsync);
 }
Example #24
0
    public Page_Games_GameViewModel GetDisplayViewModel()
    {
        try
        {
            if (IsAdded)
            {
                var actions = new List <OverflowButtonItemViewModel>();

                // Get the manager
                var manager = Game.GetManager(Game.GetGameType());

                // Add launch options if set to do so
                if (Game.GetLaunchMode() == UserData_GameLaunchMode.AsAdminOption)
                {
                    actions.Add(new OverflowButtonItemViewModel(Resources.GameDisplay_RunAsAdmin, GenericIconKind.GameDisplay_Admin, new AsyncRelayCommand(async() => await Game.GetManager().LaunchGameAsync(true))));

                    actions.Add(new OverflowButtonItemViewModel());
                }

                // Get the Game links
                var links = GetGameFileLinks?.Where(x => x.Path.FileExists).ToArray();

                // Add links if there are any
                if (links?.Any() ?? false)
                {
                    actions.AddRange(links.
                                     Select(x =>
                    {
                        // Get the path
                        string path = x.Path;

                        // Create the command
                        var command = new AsyncRelayCommand(async() => (await Services.File.LaunchFileAsync(path, arguments: x.Arguments))?.Dispose());

                        if (x.Icon != GenericIconKind.None)
                        {
                            return(new OverflowButtonItemViewModel(x.Header, x.Icon, command));
                        }

                        try
                        {
                            return(new OverflowButtonItemViewModel(x.Header, WindowsHelpers.GetIconOrThumbnail(x.Path, ShellThumbnailSize.Small).ToImageSource(), command));
                        }
                        catch (Exception ex)
                        {
                            Logger.Error(ex, "Getting file icon for overflow button item");
                            return(new OverflowButtonItemViewModel(x.Header, x.Icon, command));
                        }
                    }));

                    actions.Add(new OverflowButtonItemViewModel());
                }

                // Get additional items
                var additionalItems = manager.GetAdditionalOverflowButtonItems;

                // Add the items if there are any
                if (additionalItems.Any())
                {
                    actions.AddRange(additionalItems);

                    actions.Add(new OverflowButtonItemViewModel());
                }

                // Add RayMap link
                if (RayMapURL != null)
                {
                    actions.Add(new OverflowButtonItemViewModel(Resources.GameDisplay_Raymap, GenericIconKind.GameDisplay_Map, new AsyncRelayCommand(async() => (await Services.File.LaunchFileAsync(RayMapURL))?.Dispose())));
                    actions.Add(new OverflowButtonItemViewModel());
                }

                // Add open archive
                if (HasArchives)
                {
                    actions.Add(new OverflowButtonItemViewModel(Resources.GameDisplay_Archives, GenericIconKind.GameDisplay_Archive, new AsyncRelayCommand(async() =>
                    {
                        using IArchiveDataManager archiveDataManager = GetArchiveDataManager;

                        try
                        {
                            // Show the archive explorer
                            await Services.UI.ShowArchiveExplorerAsync(archiveDataManager, GetArchiveFilePaths(Game.GetInstallDir()).Where(x => x.FileExists).ToArray());
                        }
                        catch (Exception ex)
                        {
                            Logger.Error(ex, "Archive explorer");

                            await Services.MessageUI.DisplayExceptionMessageAsync(ex, Resources.Archive_CriticalError);
                        }
                    }), UserLevel.Advanced));
                }

                // Add open location
                actions.Add(new OverflowButtonItemViewModel(Resources.GameDisplay_OpenLocation, GenericIconKind.GameDisplay_Location, new AsyncRelayCommand(async() =>
                {
                    // Get the install directory
                    var instDir = Game.GetInstallDir();

                    // Select the file in Explorer if it exists
                    if ((instDir + DefaultFileName).FileExists)
                    {
                        instDir += DefaultFileName;
                    }

                    // Open the location
                    await Services.File.OpenExplorerLocationAsync(instDir);

                    Logger.Trace("The Game {0} install location was opened", Game);
                }), UserLevel.Advanced));

                actions.Add(new OverflowButtonItemViewModel(UserLevel.Advanced));

                // Add Game options
                var optionsAction = new OverflowButtonItemViewModel(Resources.GameDisplay_Options, GenericIconKind.GameDisplay_Config, new AsyncRelayCommand(async() =>
                {
                    Logger.Trace("The Game {0} options dialog is opening...", Game);
                    await GameOptionsDialog.ShowAsync(Game);
                }));

                actions.Add(optionsAction);

                return(new Page_Games_GameViewModel(
                           game: Game,
                           displayName: DisplayName,
                           iconSource: IconSource,
                           isDemo: IsDemo,
                           mainAction: new ActionItemViewModel(Resources.GameDisplay_Launch, GenericIconKind.GameDisplay_Play, new AsyncRelayCommand(async() => await Game.GetManager().LaunchGameAsync(false))),
                           secondaryAction: optionsAction,
                           launchActions: actions));
            }
            else
            {
                var actions = new List <OverflowButtonItemViewModel>();

                OverflowButtonItemViewModel downloadItem = null;

                if (CanBeDownloaded)
                {
                    downloadItem = new OverflowButtonItemViewModel(Resources.GameDisplay_CloudInstall, GenericIconKind.GameDisplay_Download, new AsyncRelayCommand(async() => await DownloadGameAsync()));

                    if (CanBeLocated)
                    {
                        actions.Add(downloadItem);
                        actions.Add(new OverflowButtonItemViewModel());
                    }
                }

                // Get the purchase links
                var links = Game.
                            // Get all available managers
                            GetManagers().
                            // Get the purchase links
                            SelectMany(x => x.GetGamePurchaseLinks);

                // Add links
                actions.AddRange(links.
                                 Select(x =>
                {
                    // Get the path
                    string path = x.Path;

                    // Create the command
                    var command = new AsyncRelayCommand(async() => (await Services.File.LaunchFileAsync(path))?.Dispose());

                    // Return the item
                    return(new OverflowButtonItemViewModel(x.Header, x.Icon, command));
                }));

                // Add disc installer options for specific Games
                if (CanBeInstalledFromDisc)
                {
                    // Add separator if there are previous actions
                    if (actions.Any())
                    {
                        actions.Add(new OverflowButtonItemViewModel());
                    }

                    // Add disc installer action
                    actions.Add(new OverflowButtonItemViewModel(Resources.GameDisplay_DiscInstall, GenericIconKind.GameDisplay_DiscInstall, new AsyncRelayCommand(async() =>
                    {
                        // Show and run the installer
                        await Services.DialogBaseManager.ShowDialogWindowAsync(new GameInstaller_Window(Game));
                    })));
                }

                // If the last option is a separator, remove it
                if (actions.LastOrDefault()?.IsSeparator == true)
                {
                    actions.RemoveAt(actions.Count - 1);
                }

                // Create the main action
                var mainAction = CanBeLocated
                    ? new ActionItemViewModel(Resources.GameDisplay_Locate, GenericIconKind.GameDisplay_Location, new AsyncRelayCommand(async() => await LocateGameAsync()))
                    : downloadItem;

                // Return the view model
                return(new Page_Games_GameViewModel(Game, DisplayName, IconSource, IsDemo, mainAction, null, actions));
            }
        }
        catch (Exception ex)
        {
            Logger.Fatal(ex, "Getting game display view model");
            throw;
        }
    }
        public AboutSubPageViewModel(IGitHubService gitHubService)
        {
            GitHubService = gitHubService;

            LoadDataCommand = new AsyncRelayCommand(LoadDataAsync);
        }
Example #26
0
 /// <summary>Initializes a new instance of the <see cref="MainWindowModel"/> class.</summary>
 public DocumentViewModel()
 {
     GenerateCommand = new AsyncRelayCommand <string>(GenerateAsync);
 }
 public AsyncRelayCommandPageViewModel()
 {
     DownloadTextCommand = new AsyncRelayCommand(DownloadTextAsync);
 }
 public SearchResultsViewModel(string query)
 {
     PopulateProductDetailsCommand = new AsyncRelayCommand(PopulateProductDetailsAsync);
     GetSuggestionsCommand         = new AsyncRelayCommand(GetSuggestionsAsync);
     Query = query;
 }
Example #29
0
        public SteamPaverViewModel()
        {
            _refreshCommand = AsyncRelayCommand.Lazy(() => Refresh(), null, true);
            GameDatas       = new ObservableCollectionEx <GameData>();

            var cachedGameDatas = CacheManager.LoadFromCache <GameData>()
                                  .OrderBy(o => o.Installed ? 0 : 1)
                                  .ThenBy(o => o.Name);

            //var cachedGameDatas = new GameData[] { CacheManager.LoadFromCache<GameData>($"GameData_{219740}") };


            foreach (var cachedGameData in cachedGameDatas)
            {
                GameDatas.Add(cachedGameData);
            }

            GameDatas.CollectionChanged += (o, e) =>
            {
                switch (e.Action)
                {
                case NotifyCollectionChangedAction.Add:

                    foreach (GameData item in e.NewItems)
                    {
                        item.SaveToCache();
                    }
                    break;

                case NotifyCollectionChangedAction.Remove:
                    foreach (GameData item in e.OldItems)
                    {
                        item.RemoveFromCache();
                    }
                    break;

                default:
                    break;
                }
            };

            UserData = CacheManager.LoadFromCache <UserData>().FirstOrDefault();
            if (UserData == null)
            {
                UserData = new UserData();
                UserData.SaveToCache();
            }


            UserData.PropertyChanged += (o, e) =>
            {
                UserData.SaveToCache();
            };
            App.Current.Exit += (o, e) =>
            {
                UserData.SaveToCache();
                if (SelectedGameData != null)
                {
                    SelectedGameData.SaveToCache();
                }
            };
        }
Example #30
0
        public void ConstructorFail()
        {
            IAsyncExecutionContext context = new AsyncExecutionContext();

            _ = new AsyncRelayCommand <int>(context, null);
        }
        public BuildsControlViewModel(IExtendedDialogCoordinator dialogCoordinator, IPersistentData persistentData,
                                      ISkillTree skillTree)
        {
            _dialogCoordinator = dialogCoordinator;
            PersistentData     = persistentData;
            DropHandler        = new CustomDropHandler(this);
            _buildValidator    = new BuildValidator(PersistentData.Options);
            BuildRoot          = new BuildFolderViewModel(persistentData.RootBuild, Filter, BuildOnCollectionChanged);

            _fileSystemWatcher = new FileSystemWatcher
            {
                Path = PersistentData.Options.BuildsSavePath,
                IncludeSubdirectories = true,
                NotifyFilter          = NotifyFilters.DirectoryName | NotifyFilters.FileName | NotifyFilters.LastWrite
            };
            _fileSystemWatcher.Error              += FileSystemWatcherOnError;
            _fileSystemWatcher.Changed            += FileSystemWatcherOnChanged;
            _fileSystemWatcher.Created            += FileSystemWatcherOnChanged;
            _fileSystemWatcher.Deleted            += FileSystemWatcherOnChanged;
            _fileSystemWatcher.Renamed            += FileSystemWatcherOnChanged;
            _fileSystemWatcher.EnableRaisingEvents = true;

            // The monitor alone is not enough because delays are necessary and those shouldn't block other save
            // operations, which would happen if delays are awaited directly in the save method.
            // It could be done awaited with .ConfigureAwait(false) if SimpleMonitor would be thread safe.
            _changingFileSystemMonitor.Entered += (sender, args) => _changingFileSystemCounter++;
            _changingFileSystemMonitor.Freed   += async(sender, args) =>
            {
                // Wait because FileSystemWatcherOnChanged calls are delayed a bit.
                await Task.Delay(2000);

                // This is a counter and not boolean because other save operations may happen while waiting on delay.
                _changingFileSystemCounter--;
            };

            CurrentBuild  = TreeFindBuildViewModel(PersistentData.CurrentBuild);
            SelectedBuild = TreeFindBuildViewModel(PersistentData.SelectedBuild);
            PersistentData.PropertyChanged         += PersistentDataOnPropertyChanged;
            PersistentData.Options.PropertyChanged += OptionsOnPropertyChanged;

            NewFolderCommand = new AsyncRelayCommand <IBuildFolderViewModel>(
                NewFolder,
                vm => vm != null && _buildValidator.CanHaveSubfolder(vm));
            NewBuildCommand = new RelayCommand <IBuildFolderViewModel>(NewBuild);
            DeleteCommand   = new AsyncRelayCommand <IBuildViewModel>(
                Delete,
                o => o != BuildRoot);
            OpenBuildCommand = new AsyncRelayCommand <BuildViewModel>(
                OpenBuild,
                b => b != null && (b != CurrentBuild || b.Build.IsDirty));
            SaveBuildCommand = new AsyncRelayCommand <BuildViewModel>(
                SaveBuild,
                b => b != null && b.Build.IsDirty);
            SaveBuildAsCommand   = new AsyncRelayCommand <BuildViewModel>(SaveBuildAs);
            SaveAllBuildsCommand = new AsyncRelayCommand(
                SaveAllBuilds,
                () => TreeFind <BuildViewModel>(b => b.Build.IsDirty, BuildRoot) != null);
            RevertBuildCommand = new RelayCommand <BuildViewModel>(
                build => build.Build.RevertChanges(),
                b => b != null && b.Build.IsDirty && b.Build.CanRevert);
            MoveUpCommand = new RelayCommand <IBuildViewModel>(
                MoveUp,
                o => o != BuildRoot && o.Parent.Children.IndexOf(o) > 0);
            MoveDownCommand = new RelayCommand <IBuildViewModel>(
                MoveDown,
                o => o != BuildRoot && o.Parent.Children.IndexOf(o) < o.Parent.Children.Count - 1);
            EditCommand = new AsyncRelayCommand <IBuildViewModel>(Edit);
            CutCommand  = new AsyncRelayCommand <IBuildViewModel>(
                Cut,
                b => b != BuildRoot && b != CurrentBuild);
            CopyCommand                       = new RelayCommand <IBuildViewModel <PoEBuild> >(Copy);
            PasteCommand                      = new AsyncRelayCommand <IBuildViewModel>(Paste, CanPaste);
            ReloadCommand                     = new AsyncRelayCommand(Reload);
            OpenBuildsSavePathCommand         = new RelayCommand(() => Process.Start(PersistentData.Options.BuildsSavePath));
            ExpandAllCommand                  = new RelayCommand(ExpandAll);
            CollapseAllCommand                = new RelayCommand(CollapseAll);
            ExportCurrentToClipboardCommand   = new RelayCommand(() => CopyToClipboard(CurrentBuild.Build));
            ImportCurrentFromClipboardCommand = new AsyncRelayCommand(ImportCurrentFromClipboard, CanPasteFromClipboard);

            SkillTree        = skillTree;
            ClassFilterItems = GenerateAscendancyClassItems().ToList();
            ClassFilter      = NoFilterItem;
        }
 public NewLookSourceSelectionViewModel()
 {
     OpenGalleryCommand = new AsyncRelayCommand(OpenGalleryAction, () => { /* no action  */ });
     OpenCameraCommand = new AsyncRelayCommand(OpenCameraAction, () => { /* no action  */ });
     OpenPaintCommand = new AsyncRelayCommand(OpenPaintAction, () => { /* no action  */ });
 }
Example #33
0
 public CustomFolderIcons()
 {
     this.InitializeComponent();
     RestoreDefaultIconCommand = new AsyncRelayCommand(RestoreDefaultIcon);
 }
        public LookNameChooserViewModel()
        {
            SaveCommand = new AsyncRelayCommand(SaveAction, () => { /* no action  */ }, SaveCommand_CanExecute);
            CancelCommand = new RelayCommand(CancelAction);

            Messenger.Default.Register<GenericMessage<Sprite>>(this,
                ViewModelMessagingToken.CurrentSpriteChangedListener, ReceiveSelectedSpriteMessageAction);

            Messenger.Default.Register<GenericMessage<Program>>(this,
                ViewModelMessagingToken.CurrentProgramChangedListener, CurrentProgramChangedMessageAction);

            Messenger.Default.Register<GenericMessage<PortableImage>>(this,
                ViewModelMessagingToken.LookImageListener, LookImageReceivedMessageAction);

            //if (IsInDesignMode)
            //    InitDesignData();
        }
Example #35
0
 public HomeViewModel()
 {
     LoadFeaturedCommand = new AsyncRelayCommand(LoadFeaturedAsync);
 }