public delegate EditingView Factory(); //autofac uses this public EditingView(EditingModel model, PageListView pageListView, TemplatePagesView templatePagesView, CutCommand cutCommand, CopyCommand copyCommand, PasteCommand pasteCommand, UndoCommand undoCommand, DuplicatePageCommand duplicatePageCommand, DeletePageCommand deletePageCommand, NavigationIsolator isolator) { _model = model; _pageListView = pageListView; _templatePagesView = templatePagesView; _cutCommand = cutCommand; _copyCommand = copyCommand; _pasteCommand = pasteCommand; _undoCommand = undoCommand; _duplicatePageCommand = duplicatePageCommand; _deletePageCommand = deletePageCommand; InitializeComponent(); _browser1.Isolator = isolator; _splitContainer1.Tag = _splitContainer1.SplitterDistance; //save it //don't let it grow automatically // _splitContainer1.SplitterMoved+= ((object sender, SplitterEventArgs e) => _splitContainer1.SplitterDistance = (int)_splitContainer1.Tag); SetupThumnailLists(); _model.SetView(this); _browser1.SetEditingCommands(cutCommand, copyCommand, pasteCommand, undoCommand); _browser1.GeckoReady += new EventHandler(OnGeckoReady); _menusToolStrip.Renderer = new FixedToolStripRenderer(); //we're giving it to the parent control through the TopBarControls property Controls.Remove(_topBarPanel); }
/// <summary> /// 生成版本文件 Patch /// </summary> public void generatePatch() { string ver_all = currentVerData.ver_all; string ver_patch = currentVerData.ver_patch; Console.WriteLine("开始 生成Patch :" + ver_patch); if (Directory.Exists(ver_patch)) { Directory.Delete(ver_patch, true); } foreach (var kvp in currentVerData.manifest.dict) { if (!compareVersionData.manifest.ItemEquals(kvp.Key, kvp.Value)) { string srcPath = ver_all + kvp.Value; string absoluteDestPath = ver_patch + kvp.Value; currentVerData.manifestPatch.Add(kvp.Key, kvp.Value); CopyCommand.CopyFile(srcPath, absoluteDestPath, false); } } currentVerData.manifest.SaveTo(currentVerData.ver_manifest_patch); currentVerData.manifestPatch.SaveTo(currentVerData.ver_manifestPatch); if (versionSetting.isZipVerFolderPatch) { Console.WriteLine("开始 压缩 :" + currentVerData.ver_patch_zip); ZipHelper.ZipDirectory(ver_patch, currentVerData.ver_patch_zip); } }
#pragma warning restore 0649 // Main entry point. Simply set up a httpClient to access the CI // and switch on the command to invoke underlying logic. private static int Main(string[] args) { Config config = new Config(args); int error = 0; CIClient cic = new CIClient(config); Command currentCommand = config.DoCommand; switch (currentCommand) { case Command.List: { ListCommand.List(cic, config).Wait(); break; } case Command.Copy: { CopyCommand.Copy(cic, config).Wait(); break; } default: { Console.Error.WriteLine("super bad! why no command!"); error = 1; break; } } return(error); }
// 运行 public void Run() { // 备份 if (!string.IsNullOrEmpty(item.srcBak)) { item.srcBak = item.srcBak.Replace("XXXX", time); CopyCommand.Copy(item.src, item.srcBak, true); } if (!string.IsNullOrEmpty(item.dstBak)) { item.dstBak = item.dstBak.Replace("XXXX", time); CopyCommand.Copy(item.dst, item.dstBak, true); } // 处理 try { CheckDirectory(item.src, item.dst); } catch (Exception e) { log($"[Error] {e.ToString()}"); } string logPath = item.log.Replace("XXXX", time); if (!string.IsNullOrEmpty(logPath)) { PathHelper.CheckPath(logPath); File.WriteAllText(logPath, sw.ToString(), UTF8Encoding.Default); } }
public static void Cut(User user) { try { UserSession userSession = WorldEditManager.GetUserSession(user); WorldRange region = userSession.Selection; WorldEditCommand command = new CopyCommand(user); if (command.Invoke(region)) { user.Player.MsgLoc($"Copy done in {command.ElapsedMilliseconds}ms."); command = new SetCommand(user, "Empty"); if (command.Invoke(region)) { user.Player.MsgLoc($"{command.BlocksChanged} blocks cleared in {command.ElapsedMilliseconds}ms."); } } } catch (WorldEditCommandException e) { user.Player.ErrorLocStr(e.Message); } catch (Exception e) { Log.WriteError(Localizer.Do($"{e}")); } }
public CommandEndpoint(ImportEngine engine, XmlNode node) : base(engine, node, ActiveMode.Lazy | ActiveMode.Local) { XmlNodeList chlds = node.ChildNodes;// node.SelectMandatoryNodes("*"); var cmds = new List <Command>(chlds.Count); for (int i = 0; i < chlds.Count; i++) { XmlNode n = chlds[i]; String name = n.Name; Command cmd; switch (name) { default: continue; case "command": case "exec": cmd = new ExecCommand(engine, n); break; case "delete": case "del": cmd = new DeleteCommand(engine, n); break; case "copy": cmd = new CopyCommand(engine, n); break; case "move": cmd = new MoveCommand(engine, n); break; } cmds.Add(cmd); } Commands = cmds.ToArray(); if (cmds.Count == 0) { engine.ImportLog.Log("Endpoint [{0}] has no commands. Resulting in a no-op.", Name); } }
static void Main(string[] args) { //注册EncodeProvider Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); Setting.Init(args); string time = DateTime.Now.ToString("yyyy-MM-dd-dddd-HH_mm_ss_fff"); foreach (OptionItem item in Setting.list.enableoverwrites) { item.dst = item.dst.Replace("XXXX", time); CopyCommand.Copy(item.src, item.dst, true); } foreach (OptionItem item in Setting.list.disableoverwrites) { item.dst = item.dst.Replace("XXXX", time); CopyCommand.Copy(item.src, item.dst, false); } foreach (OptionCheckItem item in Setting.list.checks) { new Checker(item).Run(); } Console.WriteLine("完成"); if (!Setting.Options.autoEnd) { Console.Read(); } }
public MainHeaderViewModel(ProjectContext projectContext, StatusInfo statusInfo, UserInterface userInterface) { if (projectContext == null) { throw new ArgumentNullException(nameof(projectContext)); } if (statusInfo == null) { throw new ArgumentNullException(nameof(statusInfo)); } this.projectContext = projectContext; CopyCommand = new CopyCommand(userInterface, projectContext); PasteCommand = new PasteCommand(userInterface, projectContext); NumericalBaseRollCommand = new NumericalBaseRollCommand(projectContext, userInterface); StatusInfoCommand = new StatusInfoCommand(statusInfo, userInterface); this.projectContext.Loaded += HandleProjectLoaded; this.projectContext.Unloaded += HandleProjectUnloaded; this.projectContext.FlagsNumberChanged += HandleFlagsNumberChanged; this.projectContext.FlagsNumber.ValueChanged += HandleMainValueChanged; this.projectContext.NumericalBaseService.NumericalBaseChanged += HandleNumericalBaseChanged; UpdateMainValue(); UpdateNumericalBaseText(); IsEnabled = projectContext.IsLoaded; }
//autofac uses this public EditingView(EditingModel model, PageListView pageListView, TemplatePagesView templatePagesView, CutCommand cutCommand, CopyCommand copyCommand, PasteCommand pasteCommand, UndoCommand undoCommand, DeletePageCommand deletePageCommand) { _model = model; _pageListView = pageListView; _templatePagesView = templatePagesView; _cutCommand = cutCommand; _copyCommand = copyCommand; _pasteCommand = pasteCommand; _undoCommand = undoCommand; _deletePageCommand = deletePageCommand; InitializeComponent(); _splitContainer1.Tag = _splitContainer1.SplitterDistance;//save it //don't let it grow automatically // _splitContainer1.SplitterMoved+= ((object sender, SplitterEventArgs e) => _splitContainer1.SplitterDistance = (int)_splitContainer1.Tag); SetupThumnailLists(); _model.SetView(this); _browser1.SetEditingCommands(cutCommand, copyCommand,pasteCommand, undoCommand); _browser1.GeckoReady+=new EventHandler(OnGeckoReady); _menusToolStrip.Renderer = new FixedToolStripRenderer(); //we're giving it to the parent control through the TopBarControls property Controls.Remove(_topBarPanel); }
async void searchDataForRootTable() { if (null != SelectedRootDataView) { if (!AppSettings.SearchValues.Contains(SelectedSearchCriteria)) { AppSettings.SearchValues.Add(SelectedSearchCriteria); AppSettings.Save(); OnPropertyChanged("AppSettings"); ClearSearchHistoryCommand.AsRelay().RaiseCanExecuteChanged(); } if (!IsBusy) { Common.Extensions.TraceLog.Information("Searching data for table {name} with {SelectedColumn} {SelectedOperator} {SearchCriteria}", WorkingTable.Root.ConfigTable.name, SelectedColumn, SelectedOperator, SearchCriteria ); IsBusy = true; var table = await WorkingTable.Root.ConfigTable .Query(SelectedOperator.ToArray(), "".ToArray(), true, new SqlParameter(SelectedColumn, SearchCriteria)); IsBusy = false; WorkingTable = table; SearchCommand.AsRelay().RaiseCanExecuteChanged(); CopyCommand.AsRelay().RaiseCanExecuteChanged(); } } }
private static bool RunCommands() { ICommand cmd = new HelpCommand(); if (!string.IsNullOrEmpty(ArgSettings.Help)) { cmd = new HelpCommand(); } else if (ArgSettings.List) { cmd = new ListCommand(); } else if (ArgSettings.Remove) { cmd = new RemoveCommand(); } else if (ArgumentsHelper.IsValidUri(ArgSettings.Source) && ArgumentsHelper.IsValidUri(ArgSettings.Destination) && ArgumentsHelper.IsValidAzureConnection(ArgSettings.SourceConnection)) { cmd = new CopyCommand(); } else if (ArgumentsHelper.IsValidUri(ArgSettings.Source) && ArgumentsHelper.IsValidFileSystemPath(ArgSettings.Destination)) { cmd = new DownloadCommand(); } else if (ArgumentsHelper.IsValidFileSystemPath(ArgSettings.Source) && ArgumentsHelper.IsValidUri(ArgSettings.Destination)) { cmd = new UploadCommand(); } return(cmd.Execute()); }
//autofac uses this public EditingView(EditingModel model, PageListView pageListView, CutCommand cutCommand, CopyCommand copyCommand, PasteCommand pasteCommand, UndoCommand undoCommand, DuplicatePageCommand duplicatePageCommand, DeletePageCommand deletePageCommand, NavigationIsolator isolator, ControlKeyEvent controlKeyEvent) { _model = model; _pageListView = pageListView; _cutCommand = cutCommand; _copyCommand = copyCommand; _pasteCommand = pasteCommand; _undoCommand = undoCommand; _duplicatePageCommand = duplicatePageCommand; _deletePageCommand = deletePageCommand; InitializeComponent(); _browser1.Isolator = isolator; _splitContainer1.Tag = _splitContainer1.SplitterDistance; //save it //don't let it grow automatically // _splitContainer1.SplitterMoved+= ((object sender, SplitterEventArgs e) => _splitContainer1.SplitterDistance = (int)_splitContainer1.Tag); SetupThumnailLists(); _model.SetView(this); _browser1.SetEditingCommands(cutCommand, copyCommand, pasteCommand, undoCommand); _browser1.GeckoReady += new EventHandler(OnGeckoReady); _browser1.ControlKeyEvent = controlKeyEvent; if(SIL.PlatformUtilities.Platform.IsMono) { RepositionButtonsForMono(); BackgroundColorsForLinux(); } controlKeyEvent.Subscribe(HandleControlKeyEvent); // Adding this renderer prevents a white line from showing up under the components. _menusToolStrip.Renderer = new FixedToolStripRenderer(); //we're giving it to the parent control through the TopBarControls property Controls.Remove(_topBarPanel); SetupBrowserContextMenu(); #if __MonoCS__ // The inactive button images look garishly pink on Linux/Mono, but look okay on Windows. // Merely introducing an "identity color matrix" to the image attributes appears to fix // this problem. (The active form looks okay with or without this fix.) // See http://issues.bloomlibrary.org/youtrack/issue/BL-3714. float[][] colorMatrixElements = { new float[] {1, 0, 0, 0, 0}, // red scaling factor of 1 new float[] {0, 1, 0, 0, 0}, // green scaling factor of 1 new float[] {0, 0, 1, 0, 0}, // blue scaling factor of 1 new float[] {0, 0, 0, 1, 0}, // alpha scaling factor of 1 new float[] {0, 0, 0, 0, 1}}; // three translations of 0.0 var colorMatrix = new ColorMatrix(colorMatrixElements); _duplicatePageButton.ImageAttributes.SetColorMatrix(colorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap); _deletePageButton.ImageAttributes.SetColorMatrix(colorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap); _undoButton.ImageAttributes.SetColorMatrix(colorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap); _cutButton.ImageAttributes.SetColorMatrix(colorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap); _pasteButton.ImageAttributes.SetColorMatrix(colorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap); _copyButton.ImageAttributes.SetColorMatrix(colorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap); #endif }
private void CopyItem(object sender, ExecutedRoutedEventArgs e) { if (RoomEditor.Instance.SelectedObj != null) { var cmd = new CopyCommand(); cmd.Execute(RoomEditor.Instance.SelectedObj); } }
public override void ProcessCopyCommand(CopyCommand cmd) { this.Session.AppendResponse( new ServerStatusResponse(cmd.Tag, ServerStatusResponseType.NO, "COPY unsupportted.") ); }
public void Destination_NonBlank_DoesValidate() { var command = new CopyCommand { Destination = "test2.txt" }; command.Validate(); }
private async void UpdateAvailableWorkspaces() { IEnumerable <Workspace> workspacesWithSettings = await Task.Run(() => tfsContext.GetWorkspaces().Where(w => w != TargetWorkspace && settingsService.HasSettings(tfsContext.SelectedProfile, w))); AvailableWorkspaces.Clear(); AvailableWorkspaces.AddRange(workspacesWithSettings.Distinct().ToList()); CopyCommand.RaiseCanExecuteChanged(); }
public virtual void ProcessCopyCommand(CopyCommand cmd) { this.Session.AppendResponse( new ServerStatusResponse(cmd.Tag, ServerStatusResponseType.NO, "COPY State Error") ); }
// --- clipboard --- //public void Copy() { // if (!_selection.IsEmpty) { // // todo: PlainTextだと範囲が変わるのでそのままではSubstring()できない // //var text = _target.ToPlainText().Substring(_selection.Offset, _selection.Length); // var text = _target.Text.Substring(_selection.Offset, _selection.Length); // text = text.Replace("\r", "\n"); // text = text.Replace("\n", Environment.NewLine); // ClipboardUtil.SetText(text); // } //} public void Copy() { if (!_selection.IsEmpty) { var cmd = new CopyCommand(_target, _selection.Range); _executor.Execute(cmd); } }
internal void MenuCopyClicked(object sender, EventArgs e) { if (scenarioTreeView.SelectedNode != null) { ICommand command = new CopyCommand(scenarioTreeView.SelectedNodes); command.Do(); } }
public CardEdit(IDataForm dataform) { this.dataform = dataform; this.addCard = new AddCommand(this); this.modCard = new ModCommand(this); this.delCard = new DelCommand(this); this.copyCard = new CopyCommand(this); }
public void TestMissingSourceFile() { string src = Path.Combine(TestConstants.TestDirectory, "a.txt"); string dst = Path.Combine(TestConstants.TestDirectory, "b.txt"); CopyCommand cc = new CopyCommand(src, dst); Assert.Throws <FileNotFoundException>(() => cc.Execute()); Assert.IsFalse(File.Exists(dst)); }
/// <summary> /// Copy command /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void OnCopy(object sender, EventArgs e) { Diagram diagram = this.CurrentDocView.CurrentDiagram; ICollection selection = this.CurrentSelection; CopyCommand copy = new CopyCommand(diagram.Store, selection); copy.Exec(); }
/// <summary> /// Sets the selected password. /// </summary> /// <param name="selected">The selected.</param> public void SetSelectedPassword(IEnumerable <string> selected) { SelectedPasswords.Clear(); foreach (string password in selected) { SelectedPasswords.Add(password); } CopyCommand.RaiseCanExecuteChanged(); }
public void TestNullSourceFilePath() { string src = null; string dst = Path.Combine(TestConstants.TestDirectory, "b.txt"); CopyCommand cc = new CopyCommand(src, dst); Assert.Throws <ArgumentNullException>(() => cc.Execute()); Assert.IsFalse(File.Exists(dst)); }
/// <summary> /// Initializes a new instance of the <see cref="RandomPasswordViewModel"/> class. /// </summary> public RandomPasswordViewModel() { GetPasswordsCommand = new GetPasswordsCommand(this); CopyCommand = new CopyCommand(this); SetProfileCommand = new SetProfileCommand(this); AddSpecialFormatItemCommand = new AddSpecialFormatItemCommand(this); ClearSpecialFormatCommand = new ClearSpecialFormatCommand(this); GetSpecialPasswordsCommand = new GetSpecialPasswordsCommand(this); }
public override void RaiseCanExecuteChanges() { base.RaiseCanExecuteChanges(); EditCommand.RaiseCanExecuteChanged(); CopyCommand.RaiseCanExecuteChanged(); MoveCommand.RaiseCanExecuteChanged(); NewFolderCommand.RaiseCanExecuteChanged(); DeleteCommand.RaiseCanExecuteChanged(); }
internal void DeselectAllShapes() { foreach (IShape shape in Selected) { shape.IsSelected = false; } Selected.Clear(); DeleteSelectedShapesCommand.RaiseCanExecuteChanged(); CopyCommand.RaiseCanExecuteChanged(); CutCommand.RaiseCanExecuteChanged(); }
public void SelectFocus(Views.UserControls.Focus selected) { FocusModel model = selected.DataContext as FocusModel; if (model == null) { return; } model.IsSelected = true; SelectedFocuses.Add(model); CopyCommand.RaiseCanExecuteChanged(); }
public void ClearSelected() { foreach (FocusModel selected in SelectedFocuses) { selected.IsSelected = false; selected.IsWaiting = false; } ModeType = RelationMode.None; SelectedFocuses.Clear(); CopyCommand.RaiseCanExecuteChanged(); PasteCommand.RaiseCanExecuteChanged(); }
public void TestNullDestinationFilePath() { string src = Path.Combine(TestConstants.TestDirectory, "a.txt"); string dst = null; const string expected = "12345"; File.WriteAllText(src, expected); CopyCommand cc = new CopyCommand(src, dst); Assert.Throws <ArgumentNullException>(() => cc.Execute()); Assert.IsFalse(File.Exists(dst)); }
public ExceptionViewModel(Exception exception, IApplicationService applicationService) { _exception = exception; _applicationService = applicationService; OpenLogFolderCommand = ReactiveCommand.Create(Observable.Return(_applicationService.LogFolder != null)) .DisposeWith(this); CopyCommand = ReactiveCommand.Create(Observable.Return(exception != null)) .DisposeWith(this); ContinueCommand = ReactiveCommand.Create() .DisposeWith(this); ExitCommand = ReactiveCommand.Create() .DisposeWith(this); RestartCommand = ReactiveCommand.Create() .DisposeWith(this); OpenLogFolderCommand.ActivateGestures() .Subscribe(x => OpenLogFolder()) .DisposeWith(this); CopyCommand.ActivateGestures() .Subscribe(x => Copy()) .DisposeWith(this); ContinueCommand.ActivateGestures() .Subscribe(x => Continue()) .DisposeWith(this); ExitCommand .ActivateGestures() .Subscribe(x => Exit()) .DisposeWith(this); RestartCommand .ActivateGestures() .Subscribe(x => Restart()) .DisposeWith(this); Closed.Take(1) .Subscribe(x => { // Force all other potential exceptions to be realized // from the Finalizer thread to surface to the UI GC.Collect(2, GCCollectionMode.Forced); GC.WaitForPendingFinalizers(); }) .DisposeWith(this); }
public void ShouldRollbackFileCopy() { // Given var command = new CopyCommand (FilePath, DestinyFilePath); command.Execute (); // When command.Rollback (); // Then Assert.IsTrue (File.Exists (FilePath)); Assert.IsFalse (File.Exists (DestinyFilePath)); }
public object Clone() { CopyCommand replica = new CopyCommand(cardedit); replica.copied = this.copied; replica.NewCards = (Card[])this.NewCards.Clone(); replica.replace = this.replace; if (this.OldCards != null) { replica.OldCards = (Card[])this.OldCards.Clone(); } return(replica); }
public void ShouldThrowExceptionIfFileDoesntExist() { // When var command = new CopyCommand (@"c:\temp\abc.txt", DestinyFilePath); command.Execute (); }
public void Destination_Blank_DoesNotValidate() { var command = new CopyCommand(); Assert.Throws<InvalidOperationException>(command.Validate); }
public object Clone() { CopyCommand replica = new CopyCommand(cardedit); replica.copied = this.copied; replica.NewCards = (Card[])this.NewCards.Clone(); replica.replace = this.replace; if (this.OldCards != null) replica.OldCards = (Card[])this.OldCards.Clone(); return replica; }
public WebDAVListener(IHttpServer server, string path) { this.HttpServer = server; OptionsCommand optionsCommand = new OptionsCommand(); optionsCommand.Start(this, path); commands.Add(optionsCommand); PropFindCommand propfindCommand = new PropFindCommand(); propfindCommand.Start(this, path); commands.Add(propfindCommand); LockCommand lockCommand = new LockCommand(); lockCommand.Start(this, path); commands.Add(lockCommand); UnlockCommand unlockCommand = new UnlockCommand(); unlockCommand.Start(this, path); commands.Add(unlockCommand); MkcolCommand mkcolCommand = new MkcolCommand(); mkcolCommand.Start(this, path); commands.Add(mkcolCommand); MoveCommand moveCommand = new MoveCommand(); moveCommand.Start(this, path); commands.Add(moveCommand); GetCommand getCommand = new GetCommand(); getCommand.Start(this, path); commands.Add(getCommand); PutCommand putCommand = new PutCommand(); putCommand.Start(this, path); commands.Add(putCommand); DeleteCommand deleteCommand = new DeleteCommand(); deleteCommand.Start(this, path); commands.Add(deleteCommand); CopyCommand copyCommand = new CopyCommand(); copyCommand.Start(this, path); commands.Add(copyCommand); PropPatchCommand proppatchCommand = new PropPatchCommand(); proppatchCommand.Start(this, path); commands.Add(proppatchCommand); }