public FolderChooserViewModel(ConfigurationService appConf, Aria2Service aria2Service) { AppConf = appConf; AppConf.PropertyChanged += AppConf_PropertyChanged; _aria2Service = aria2Service; BrowseCommand = new RelayCommand(AppConf.BrowseAria2Folder); DownloadCommand = new RelayCommand(AppConf.ViewAria2OfficialSite); }
public MainViewModel(ConfigurationService appConf, Aria2Service a2) { Configuration = appConf; Aria2 = a2; StartAria2Command = new RelayCommand(Aria2.StartAria2, () => !Aria2.IsRunning); StopAria2Command = new RelayCommand(Aria2.StopAria2, () => Aria2.IsRunning); ShowAria2ConfWindowCommand = new RelayCommand(() => new Aria2ConfigureWindow().Show(), Aria2.CheckConfExist); ShowAppConfWindowCommand = new RelayCommand(() => new AppConfigWindow().Show()); Aria2.Aria2Exited += Aria2Service_OnAria2Exited; }
public AppConfigViewModel(ConfigurationService appConf, Aria2Service a2) { Configuration = appConf; Aria2 = a2; CheckAria2Path(); Configuration.PropertyChanged += Configuration_PropertyChanged; BrowseAria2DirCommand = new RelayCommand(Configuration.BrowseAria2Folder); ViewOfficialSiteCommand = new RelayCommand(Configuration.ViewAria2OfficialSite); GenerateConfFileCommand = new RelayCommand(() => { File.WriteAllText(Aria2.GetConfPath(), "enable-rpc=true"); FalledConf = false; }, () => !HasAria2Path || FalledConf); SwitchAutoStartCommand = new RelayCommand <bool>(Configuration.SwitchAutoStart); }
public Aria2ConfigureViewModel(ConfigurationService appConf, Aria2Service a2) { AppConfService = appConf; _aria2Service = a2; string json = File.ReadAllText("./Aria2ConfDoc.json"); _aria2ConfService = new Aria2ConfService(json); UpdateTrackerCommand = new AsyncRelayCommand <string>(_aria2ConfService.UpdateTracker, s => { if (s != null) { return(s.StartsWith("http")); } return(false); }); }
public TaskBarViewModel(ConfigurationService appConf, Aria2Service a2) { Configuration = appConf; Aria2 = a2; StartAria2Command = new RelayCommand(Aria2.StartAria2, () => !Aria2.IsRunning); StopAria2Command = new RelayCommand(Aria2.StopAria2, () => Aria2.IsRunning); ShowWindowCommand = new RelayCommand(() => new MainWindow().Show(), () => !(Application.Current.Windows.ContainsWindow <MainWindow>() || Application.Current.Windows.ContainsWindow <FolderChooserWindow>())); ExitAppCommand = new RelayCommand(() => { Application.Current.Shutdown(); }); AutoStartCommand = new RelayCommand <bool>(Configuration.SwitchAutoStart); Aria2.Aria2Exited += Aria2Service_OnAria2Exited; }