public LoginOptionContentViewModel(IRegionManager regionManager, IEventAggregator eventAggregator, ISwitchContentService switchContentService, ICloudDriveConfigManager cloudDriveConfigManager, IWebDavClientService webDavClientService) { this._regionManager = regionManager; this._eventAggregator = eventAggregator; this._switchContentService = switchContentService; this._webDavClientService = webDavClientService; this._cloudDriveConfigManager = cloudDriveConfigManager; this.TestConnectionCommand = new DelegateCommand(this.TestConnectionAction, () => true); this.AcceptConnectionCommand = new DelegateCommand(this.AcceptConnectionAction, () => true); this.DataServerAddress = this._cloudDriveConfigManager.ReadConfig(CloudDriveConfigManager.DataServerSectionConstant, CloudDriveConfigManager.DataServerAddressConstant); this.DataServerPort = this._cloudDriveConfigManager.ReadConfig(CloudDriveConfigManager.DataServerSectionConstant, CloudDriveConfigManager.DataServerPortConstant); }
public LoginViewContentViewModel(IRegionManager regionManager, IEventAggregator eventAggregator, ISwitchContentService switchContentService, IWebDavClientService webDavClientService, ICloudDriveConfigManager cloudDriveConfigManager) { this._regionManager = regionManager; this._eventAggregator = eventAggregator; this._switchContentService = switchContentService; this._webDavClientService = webDavClientService; this._cloudDriveConfigManager = cloudDriveConfigManager; this.LoginCommand = new DelegateCommand <object>(this.LoginAction, this.CanLoginAction); InitWebDavConfig(); this.PropertyChanged += OnPropertyChanged; this.ViewLoadedAction = ReadUserInfoFromConfig; this._eventAggregator.GetEvent <ConfigChangeEvent>().Subscribe(InitWebDavConfig); this._eventAggregator.GetEvent <SwitchuserEvent>().Subscribe(SwitchuserFunction, ThreadOption.UIThread); }
public CloudDriveTransferViewModel(IEventAggregator eventAggregator, IWebDavClientService webDavClientService, ISwitchContentService switchContentService , ITransferDataService transferDataService) { this._eventAggregator = eventAggregator; this._webDavClientService = webDavClientService; this._switchContentService = switchContentService; this._transferDataService = transferDataService; this.TransferInfos = new ObservableCollection <TransferInfo>(this._transferDataService.RetriveHistory()); this.BackCommand = new DelegateCommand(this.Back, this.CanBack); this.ClearCommand = new DelegateCommand(this.Clear, this.CanClear); this.CancelAllCommand = new DelegateCommand(this.CancelAll, this.CanCancelAll); this.NavigateItemCommand = new DelegateCommand <TransferInfo>(this.NavigateItem, this.CanNavigateItem); this.CancelTransferCommand = new DelegateCommand <TransferInfo>(this.CancelTransfer, this.CanCancelTransfer); this._eventAggregator.GetEvent <PubSubEvent <TransferActionInfo> >().Subscribe(UploadOrDownloadAction); this._eventAggregator.GetEvent <PubSubEvent <EditorActionInfo> >().Subscribe(EditorAction); this._eventAggregator.GetEvent <WindowClosingEvent>().Subscribe(SaveTransferInfos, ThreadOption.UIThread); }
public CloudDriveExplorerViewModel(IEventAggregator eventAggregator, IWebDavClientService webDavClientService, ISwitchContentService switchContentService) { this._eventAggregator = eventAggregator; this._webDavClientService = webDavClientService; this._switchContentService = switchContentService; this.ResouceNavigateCommand = new DelegateCommand <object>(this.ResouceNavigate, this.CanResouceNavigate); this.ResourceEditCommand = new DelegateCommand(this.ResouceEdit, this.CanResouceEdit); this.ResouceHomeCommand = new DelegateCommand(this.ResouceHome, this.CanResouceHome); this.ResouceOpenCommand = new DelegateCommand(this.ResouceOpen, this.CanResouceOpen); this.ResourceCreateCommand = new DelegateCommand(this.ResouceCreate, this.CanResouceCreate); this.ResourceUploadCommand = new DelegateCommand(this.ResouceUpload, this.CanResouceUpload); this.ResourceCopyCommand = new DelegateCommand(this.ResouceCopy, this.CanResouceCopy); this.ResourceCutCommand = new DelegateCommand(this.ResouceCut, this.CanResouceCut); this.ResourcePasteCommand = new DelegateCommand(this.ResoucePaste, this.CanResoucePaste); this.ResourceRenameCommand = new DelegateCommand(this.ResouceRename, this.CanResouceRename); this.ResourceRefreshCommand = new DelegateCommand(this.ResouceRefresh, this.CanResouceRefresh); this.DeleteSelectedCommand = new DelegateCommand(this.DeleteSelected, this.CanDeleteSelected); this.DownloadSelectedCommand = new DelegateCommand(this.DownloadSelected, this.CanDownloadSelected); this.UploadSelectedCommand = new DelegateCommand(this.UploadSelected, this.CanUploadSelected); this.TransferListViewCommand = new DelegateCommand(this.TransferList, this.CanTransferList); this.PropertyChanged += OnPropertyChanged; this.RenameCallbackAction = RenameCallbackFunction; this.ResourceItemClickAction = ResourceItemClickFunction; this.DropUploadCallbackAction = DropUploadCallbackFunction; this.ResourceItems = new ObservableCollection <ResourceItem>(); this.CurrentPathList = new ObservableCollection <string>(); this.LastCutOrCopyResourceItems = new ObservableCollection <ResourceItem>(); this.LastCutOrCopyResourceItems.CollectionChanged += LastCutOrCopyResourceItems_CollectionChanged; this._eventAggregator.GetEvent <RefreshEvent>().Subscribe(path => { if (path == null) { path = this.CurrentNavigateResourceItem != null ? this.CurrentNavigateResourceItem.ItemHref : WebDavConstant.RootPath; } this.RefreshCurrentResource(path); }); this._eventAggregator.GetEvent <PasteFileEvent>().Subscribe(files => { if (files != null) { this.DropUploadCallbackFunction(files); } }); this._eventAggregator.GetEvent <PasteResourceEvent>().Subscribe(() => { //Ctrl V Just Need Current Folder this.ResoucePasteAction(true); }); this._eventAggregator.GetEvent <TransferStatusEvent>().Subscribe(process => { this.TransfersProgress = process; this.HasRunningTransfers = process < 100; if (!this.HasRunningTransfers) { this.RefreshCurrentResource(); } }); this._eventAggregator.GetEvent <GlobalExceptionEvent>().Subscribe((message) => { this.NotifyMessageInfo(string.Format("操作异常:{0}", message)); }); this._eventAggregator.GetEvent <CreateFolderStatusEvent>().Subscribe(CreateFolderCallback); this.RefreshCurrentResource(); }