コード例 #1
0
        public static void OnSkippedChange(object sender, SkippedChangeEventArgs args)
        {
            SharpToolsMVVMMediator.NotifyColleagues("update", "Error! Skipped file: " + args.ChangeType.ToString().ToUpper() + " for "
                                                    + (!string.IsNullOrEmpty(args.CurrentFilePath) ? args.CurrentFilePath : args.NewFilePath));

            if (args.Exception != null)
            {
                SharpToolsMVVMMediator.NotifyColleagues("update", "Error: " + args.Exception.Message);
            }
        }
コード例 #2
0
        /// <summary>
        /// Constructor created from supplied args.
        /// </summary>
        /// <param name="p_syncPair"></param>
        /// <param name="p_syncPairRepository"></param>
        /// <param name="wsCommands"></param>
        public SyncPairViewModel(SyncPair p_syncPair, SyncPairRepository p_syncPairRepository, IWorkspaceCommands wsCommands)
        {
            // Create local commands.
            _wsCommands = wsCommands;

            // Check sync pair exists.
            if (p_syncPair == null)
            {
                throw new ArgumentNullException("p_syncPair");
            }

            // Check sync repository exists.
            if (p_syncPairRepository == null)
            {
                throw new ArgumentNullException("p_syncPairRepository");
            }

            // Set sync pair.
            _syncPair = p_syncPair;
            // Set sync pair repository.
            _syncPairRepository = p_syncPairRepository;

            // Set sync type if specified.
            if (_syncPair.SyncType == null)
            {
                _syncPairType = Strings.SyncPairViewModel_SyncPairTypeOption_NotSpecified;
            }
            else
            {
                _syncPairType = _syncPair.SyncType;
            }

            // Initialise source root retrieval.
            GetSrcRootCommand = new SharpToolsMVVMRelayCommand(GetSrcRoot);

            // Initialise destination root retrieval.
            GetDstRootCommand = new SharpToolsMVVMRelayCommand(GetDstRoot);

            // Initialise source root browser.
            BrowseSrcRootCommand = new SharpToolsMVVMRelayCommand(BrowseSrcRoot);

            // Initialise destination root browser.
            BrowseDstRootCommand = new SharpToolsMVVMRelayCommand(BrowseDstRoot);

            // Initialise delete sync pair.
            DeleteSyncPairCommand = new SharpToolsMVVMRelayCommand(Delete);

            SharpToolsMVVMMediator.Register("update", AddUpdate); // Listener for change events
            // LOG
            _log.Debug("Mediator Registered");
            //
            ResultLog = new ObservableCollection <string>();
        }
コード例 #3
0
        public static void OnAppliedChange(object sender, AppliedChangeEventArgs args)
        {
            switch (args.ChangeType)
            {
            case ChangeType.Create:
                SharpToolsMVVMMediator.NotifyColleagues("update", "File created: " + args.NewFilePath);
                break;

            case ChangeType.Delete:
                SharpToolsMVVMMediator.NotifyColleagues("update", "Deleted File: " + args.OldFilePath);
                break;

            case ChangeType.Update:
                SharpToolsMVVMMediator.NotifyColleagues("update", "Overwrote file: " + args.OldFilePath);
                break;

            case ChangeType.Rename:
                SharpToolsMVVMMediator.NotifyColleagues("update", "Renamed file: " + args.OldFilePath + " to " + args.NewFilePath);
                break;
            }
        }