Exemple #1
0
        public TopNavigationViewModel(IRegionManager regionManager, IEventAggregator eventAggregator, ISwitchContentService switchContentService)
        {
            this._regionManager        = regionManager;
            this._eventAggregator      = eventAggregator;
            this._switchContentService = switchContentService;
            this.SelectedCommand       = new DelegateCommand(this.SelectedChanged);

            this._switchContentService.SwitchContentView(RegionNames.CloudDriveContentView);
        }
Exemple #2
0
 public CloudSettingCommonViewModel(IRegionManager regionManager, IEventAggregator eventAggregator,
                                    ISwitchContentService switchContentService, ICloudDriveConfigManager cloudDriveConfigManager)
 {
     this._regionManager           = regionManager;
     this._eventAggregator         = eventAggregator;
     this._switchContentService    = switchContentService;
     this._cloudDriveConfigManager = cloudDriveConfigManager;
     this.ViewLoadedAction         = () =>
     {
     };
     this.PropertyChanged += CloudSettingCommonViewModel_PropertyChanged;
 }
        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 CloudSettingContentViewModel(IRegionManager regionManager, IEventAggregator eventAggregator, ISwitchContentService switchContentService)
 {
     this._regionManager        = regionManager;
     this._eventAggregator      = eventAggregator;
     this._switchContentService = switchContentService;
     this.PropertyChanged      += CloudDriveContentViewModel_PropertyChanged;
     this.ViewLoadedAction      = () =>
     {
         this._switchContentService.SwitchContentView(RegionNames.ActionCloudSettingRightRegion, this.SelectedMenu.ViewName);
     };
     this.LeftMenus = new List <LeftMenu>()
     {
         new LeftMenu("设置", string.Format("/{0};component/Resources/{1}", GetType().Assembly.FullName, "set.png"), RegionNames.CloudSettingCommon),
     };
     this.SelectedMenu = LeftMenus.First();
 }
 public LoginViewModel(IRegionManager regionManager, IEventAggregator eventAggregator, ISwitchContentService switchContentService)
 {
     this._regionManager           = regionManager;
     this._eventAggregator         = eventAggregator;
     this._switchContentService    = switchContentService;
     this.ExitShellCommand         = new DelegateCommand(this.ExitShell, this.CanExitShell);
     this.MinimizeShellCommand     = new DelegateCommand(this.MinimizeShell, this.CanMinimizeShell);
     this.OptionSwitchShellCommand = new DelegateCommand(this.OptionSwitchShell, this.CanOptionSwitchShell);
     this.ViewLoadedAction         = () => { this._switchContentService.SwitchContentView(RegionNames.LoginContentRegion, RegionNames.LoginViewContentView); };
     this._eventAggregator.GetEvent <LoginStatusEvent>().Subscribe((status) =>
     {
         if (RequestClose != null)
         {
             RequestClose(this, new LoginStatusEventArgs(status));
         }
     });
 }
Exemple #6
0
        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);
        }
Exemple #7
0
        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);
        }
Exemple #8
0
        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();
        }