Ejemplo n.º 1
0
        public FileReplaceMode GetReplaceAction(string source, DateTime sourceModified, string target, DateTime targetModified)
        {
            if (persistentMode != FileReplaceMode.NotSet)
            {
                return(persistentMode);
            }

            //IFileReplacePolicy is not likely to be running in the GUI thread
            //so use some DispatchService magic to synchronously call the dialog in the GUI thread
            DispatchService.GuiSyncDispatch(delegate
            {
                var dialog = new FileReplaceDialog(response, source, sourceModified.ToString(), target, targetModified.ToString());
                response   = (FileReplaceDialog.ReplaceResponse)MessageService.ShowCustomDialog(dialog);
            });

            switch (response)
            {
            case FileReplaceDialog.ReplaceResponse.Replace:
                return(FileReplaceMode.Replace);

            case FileReplaceDialog.ReplaceResponse.ReplaceAll:
                persistentMode = FileReplaceMode.Replace;
                return(FileReplaceMode.Replace);

            case FileReplaceDialog.ReplaceResponse.ReplaceOlder:
                return(FileReplaceMode.ReplaceOlder);

            case FileReplaceDialog.ReplaceResponse.ReplaceOlderAll:
                persistentMode = FileReplaceMode.ReplaceOlder;
                return(FileReplaceMode.ReplaceOlder);

            case FileReplaceDialog.ReplaceResponse.Skip:
                return(FileReplaceMode.Skip);

            case FileReplaceDialog.ReplaceResponse.SkipAll:
                persistentMode = FileReplaceMode.Skip;
                return(FileReplaceMode.Skip);

            case FileReplaceDialog.ReplaceResponse.Abort:
                return(FileReplaceMode.Abort);

            default:
                throw new Exception("Unexpected ReplaceResponse value");
            }
        }
Ejemplo n.º 2
0
		public FileReplaceMode GetReplaceAction (string source, DateTime sourceModified, string target, DateTime targetModified)
		{
			if (persistentMode != FileReplaceMode.NotSet)
				return persistentMode;
			
			//IFileReplacePolicy is not likely to be running in the GUI thread
			//so use some DispatchService magic to synchronously call the dialog in the GUI thread
			DispatchService.GuiSyncDispatch (delegate {
				var dialog = new FileReplaceDialog (response, source, sourceModified.ToString (), target, targetModified.ToString ());
				response = (FileReplaceDialog.ReplaceResponse) MessageService.ShowCustomDialog (dialog);
			});
			
			switch (response) {
			case FileReplaceDialog.ReplaceResponse.Replace:
				return FileReplaceMode.Replace;
			
			case FileReplaceDialog.ReplaceResponse.ReplaceAll:
				persistentMode = FileReplaceMode.Replace;
				return FileReplaceMode.Replace;
			
			case FileReplaceDialog.ReplaceResponse.ReplaceOlder:
				return FileReplaceMode.ReplaceOlder;
			
			case FileReplaceDialog.ReplaceResponse.ReplaceOlderAll:	
				persistentMode = FileReplaceMode.ReplaceOlder;
				return FileReplaceMode.ReplaceOlder;
			
			case FileReplaceDialog.ReplaceResponse.Skip:
				return FileReplaceMode.Skip;
			
			case FileReplaceDialog.ReplaceResponse.SkipAll:
				persistentMode = FileReplaceMode.Skip;
				return FileReplaceMode.Skip;
			
			case FileReplaceDialog.ReplaceResponse.Abort:			
				return FileReplaceMode.Abort;
			
			default:
				throw new Exception ("Unexpected ReplaceResponse value");
			}
			
		}
 public SimpleFileReplacePolicy(FileReplaceMode mode)
 {
     this.mode = mode;
 }
Ejemplo n.º 4
0
		public SimpleFileReplacePolicy (FileReplaceMode mode)
		{
			this.mode = mode;
		}