private void SelectedBlobs_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { SelectedBlob = SelectedBlobs.Count == 1 ? SelectedBlobs[0] : null; DeleteBlobsCommand?.RaiseCanExecuteChanged(); ViewBlobCommand?.RaiseCanExecuteChanged(); RenameCommand?.RaiseCanExecuteChanged(); ExternalOpenCommand?.RaiseCanExecuteChanged(); CopySelectedBlobsCommand?.RaiseCanExecuteChanged(); ShowBlobPropertiesCommand?.RaiseCanExecuteChanged(); DownloadBlobsCommand?.RaiseCanExecuteChanged(); }
public void ExecuteTest() { var command = new RenameCommand(); command.Execute(new RenameExecuteParams { DestinationPath = @"d:\M1200", SourcePath = @"D:\M1124_KB治具 - コピー", PrefixName = "M1200", Signature = "木下", Settings = new Settings.OptionSettingsSerializer().Load() }); }
/// <summary> /// Sets IsEditing to false when the ViewItem that contains an EditBox changes its size /// </summary> /// <param name="bCancelEdit"></param> private void OnSwitchToNormalMode(bool bCancelEdit = true) { lock (_lockObject) { if (_DestroyNotificationOnFocusChange == false) { DestroyTip(); } if (IsEditing == true) { string sNewName = string.Empty; if (_TextBox != null) { sNewName = _TextBox.Text; } if (bCancelEdit == false) { if (_TextBox != null) { // Tell the ViewModel (if any) that we'd like to rename this item if (RenameCommand != null) { var tuple = new Tuple <string, object>(sNewName, RenameCommandParameter); RenameCommand.Execute(tuple); } } } else { if (_TextBox != null) { _TextBox.Text = this.Text; } } IsEditing = false; Mouse.RemovePreviewMouseDownOutsideCapturedElementHandler(this, OnMouseDownOutsideElement); ReleaseMouseCapture(); _PART_TextBlock.Focus(); _PART_TextBlock.Visibility = System.Windows.Visibility.Visible; _PART_MeasureTextBlock.Visibility = System.Windows.Visibility.Hidden; } } }
private void CONTENT_OFF_OnPreviewKeyDown(object sender, KeyEventArgs e) { switch (e.Key) { case Key.Enter: case Key.Tab: IsInRenamingMode = false; RenameCommand?.Execute(CONTENT_OFF.Text); break; case Key.Escape: IsInRenamingMode = false; break; } }
public void RenameTest() { IMaxNode node = MaxNodeWrapper.Create(MaxRemoting.CreateBox()); Assert.IsNotNull(node); String oldName = node.Name; String newName = "Test"; RenameCommand cmd = new RenameCommand(node.ToIEnumerable(), newName); cmd.Redo(); Assert.AreEqual(newName, node.Name); cmd.Restore(true); Assert.AreEqual(oldName, node.Name); }
public NotesVM() { NewNoteCommand = new NewNoteCommand(this); NewNotebookCommand = new NewNotebookCommand(this); RenameCommand = new RenameCommand(this); EndRenamingCommand = new EndRenamingCommand(this); DeleteCommand = new DeleteCommand(this); Notebooks = new ObservableCollection <Notebook>(); Notes = new ObservableCollection <Note>(); getNotebooks(); RenameNotebookTextBoxVisibility = Visibility.Collapsed; RenameNoteTextBoxVisibility = Visibility.Collapsed; }
/// <summary> /// 创建指令 /// </summary> public static void Do(EType type, string oriName, string newName) { var command = new RenameCommand(); command.Type = type; command.OriName = oriName; command.NewName = newName; var sequence = GameEntry.Command.Sequence(); sequence.AppendCommand(new CheckCurrencyCommand(command)); sequence.AppendCommand(command); sequence.AppendCommand(new DoCurrencyCostCommand(command)); sequence.AppendCommand(new DataUpdatedCommand()); sequence.AppendResultHandler(command.HandleResult); }
public static CallbackStatus UpdateProgressCallback(ProgressMsg msg, object info, object progctx) { CallbackTested tested = progctx as CallbackTested; Assert.IsNotNull(tested); switch (msg) { case ProgressMsg.UpdateBeginCommand: case ProgressMsg.UpdateEndCommand: { UpdateProgress m = (UpdateProgress)info; Assert.IsNotNull(m); tested.Set(); UpdateCommand cmd = m.Command; Console.WriteLine($"Commands = {m.CompletedCommands}/{m.TotalCommands}"); switch (cmd.Op) { case UpdateOp.Add: { AddCommand add = cmd.Add; Console.WriteLine($"ADD [{add.FsSourcePath}] -> [{add.WimTargetPath}]"); } break; case UpdateOp.Delete: { DeleteCommand del = cmd.Delete; Console.WriteLine($"DELETE [{del.WimPath}]"); } break; case UpdateOp.Rename: { RenameCommand ren = cmd.Rename; Console.WriteLine($"RENAME [{ren.WimSourcePath}] -> [{ren.WimTargetPath}]"); } break; } } break; } return(CallbackStatus.Continue); }
void OnSelectedItemChanged(ProjectItem oldValue, ProjectItem newValue) { if (oldValue != null) { oldValue.TextChanged -= OnTextChanged; } if (newValue != null) { newValue.TextChanged += OnTextChanged; } SaveCommand.RaiseCanExecuteChanged(); SaveAsCommand.RaiseCanExecuteChanged(); CloseAllTabsCommand.RaiseCanExecuteChanged(); CloseCurrentTabCommand.RaiseCanExecuteChanged(); AddNewFolderCommand.RaiseCanExecuteChanged(); ContextMenuAddFolderCommand.RaiseCanExecuteChanged(); RenameCommand.RaiseCanExecuteChanged(); }
internal override void Display() { if (IsActive) { if (ImGui.Begin("Rename", ref IsActive, _flags)) { ImGui.InputText("##name", nameInputBuffer, 16); ImGui.SameLine(); if (ImGui.SmallButton("Set")) { RenameCommand.CreateRenameCommand(_state.Game, _state.Faction, _entityState.Entity, nameString); _entityState.Name = nameString; _entityState.NameIcon.NameString = nameString; IsActive = false; } } ImGui.End(); } }
protected override async System.Threading.Tasks.Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress) { await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); await base.InitializeAsync(cancellationToken, progress); // Attach to solution events solution = GetService(typeof(SVsSolution)) as IVsSolution; var re = solution.AdviseSolutionEvents(new SolutionEventListener(), out solutionEventsCookie); FindAllReferencesCommand.Initialize(this); FindRefsWindowCommand.Initialize(this); GoToDefinitionCommand.Initialize(this); GoToVisitorCommand.Initialize(this); NextSymCommand.Initialize(this); OptionsCommand.Initialize(this); ReformatCommand.Initialize(this); RenameCommand.Initialize(this); AboutCommand.Initialize(this); }
private void CONTENT_OFF_OnPreviewLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) { if (!IsInRenamingMode) { return; } if (CONTENT_OFF.ContextMenu.IsOpen) { return; } if (e.NewFocus == CONTENT_OFF) { return; } IsInRenamingMode = false; RenameCommand?.Execute(CONTENT_OFF.Text); }
/// <summary> /// サイレントモードを実行する /// </summary> /// <param name="param">パラメータ</param> /// <returns></returns> static void RunSilent(string[] param) { RenameLogger.ConsoleMode = true; NativeMethods.AttachConsole(uint.MaxValue); var args = param; //コマンドライン不正時の処理 if (!IsValidCommandLine(args, out string msg)) { var e = new CommandLineArgumentException( msg, CommandLineArgumentErrorCategory.ApplyValueError); RenameLogger.WriteLog(new LogItem { Exception = e, Level = LogLevel.Error, Message = InvalidCommandLineParam() });; throw e; } //実行コマンド var command = new RenameCommand(); //実行 command.Execute(new RenameExecuteParams { SourcePath = args[0], DestinationPath = args[1], PrefixName = args[2], Signature = args[3], Settings = new OptionSettingsSerializer().Load() }); //変換結果を出力 var outStream = Console.Out; foreach (var line in command.RecordItems) { outStream.WriteLine(line); } //コマンドの破棄 command.Dispose(); }
/// <summary> /// Apply a rename action /// </summary> private void ApplyRenaming() { // Check if there's a name given var newName = nameInput.text; if (newName == "") { toast.Error(Toast.Short, "Name cannot be empty!"); // Reset name if empty nameInput.text = nameText.text; CancelRenaming(); return; } // Hide the input field an show the name field nameInputObject.SetActive(false); nameTextObject.SetActive(true); showStation.SetActive(IsStation); // Check if nothing is changed if (nameInput.text == nameText.text) { return; } var renameCommand = new RenameCommand(item.name, nameText.text, newName); // Add the Command to the group if there is "Group Selected" if (_isRenameInitial) { _commandGroup.AddToGroup(renameCommand); renameCommand.Redo(); _isRenameInitial = false; } else { _undoService.AddCommand(renameCommand); } }
public async Task Rename_folder() { Directory.CreateDirectory(_TestFolderOriginPath); if (Directory.Exists(_TestFolderNewPath)) { Directory.Delete(_TestFolderNewPath); } var cmd = new RenameCommand { OriginName = _TestFolderOriginName, NewName = _TestFolderNewName }; await Mediator.Send(cmd); Directory.Exists(_TestFolderNewPath).Should().BeTrue(); Directory.Exists(_TestFolderOriginPath).Should().BeFalse(); Directory.Delete(_TestFolderNewPath); }
/// <summary> /// Generate the list of commands to rename the files /// </summary> /// <returns>A list of RenameCommands</returns> public List <RenameCommand> GenerateRenameCommands() { //GenerateNewFileNames(); if (Clashes) { throw (new RenameClashException()); } List <RenameCommand> commands = new List <RenameCommand>(_fileMetaData.Count); // The IOMove object is used to perform IO actions with the filesystem var mover = IOMove.Create(); for (int i = 0; i < _fileMetaData.Count; i++) { var rename = new RenameCommand(mover); rename.Initialize(_fileMetaData[i].Directory, _fileMetaData[i].Name, Files[i].NewFileName); commands.Add(rename); } return(commands); }
/***************************************************/ private Output <List <object>, bool> RunCommand(IMRCCommand command) { string source = command.FullPath?.NormalisePath(false); string target = command.TargetFullPath?.NormalisePath(false); bool overwriteTarget = command.OverwriteTarget; if (string.IsNullOrWhiteSpace(source) || string.IsNullOrWhiteSpace(target)) { BH.Engine.Base.Compute.RecordWarning("Please specify a valid oM.Adapters.Filing.Command."); return(null); } RenameCommand renameCommand = command as RenameCommand; if (renameCommand != null) { return(Move(source, target, true, overwriteTarget)); } MoveCommand moveCommand = command as MoveCommand; if (moveCommand != null) { return(Move(source, target, false, overwriteTarget, moveCommand.CreateDirectoryIfNotExist)); } CopyCommand copyCommand = command as CopyCommand; if (copyCommand != null) { return(Copy(source, target, overwriteTarget, copyCommand.CreateDirectoryIfNotExist)); } return(new Output <List <object>, bool>() { Item1 = new List <object>(), Item2 = false }); }
protected void SetupCommands(Func <ExModel[]> getSelectionFunc, Func <DirectoryModel> getCurrentFunc, Func <System.Drawing.Point> getMousePositionFunc) { #region OpenCommand and ContextMenuCommand OpenCommand = new SimpleRoutedCommand(ApplicationCommands.Open) { CanExecuteDelegate = x => { return(getCurrentFunc() != null); }, ExecuteDelegate = x => { Process.Start(getCurrentFunc().EmbeddedDirectoryEntry.FullName); } }; ContextMenuCommand = new SimpleRoutedCommand(ApplicationCommands.ContextMenu) { CanExecuteDelegate = x => { return(getSelectionFunc() != null && getSelectionFunc().Length > 0); }, ExecuteDelegate = x => { ContextMenuWrapper _cmw = new ContextMenuWrapper(); _cmw.OnBeforeInvokeCommand += (InvokeCommandEventHandler) delegate(object sender, InvokeCommandEventArgs args) { if (args.Command == "open") { args.ContinueInvoke = false; } if (args.Command == "openas" && args.SelectedItems != null && args.SelectedItems.Length == 1) { args.ContinueInvoke = false; } }; var selectedItems = (from model in getSelectionFunc() select model.EmbeddedEntry).ToArray(); System.Drawing.Point pt = getMousePositionFunc(); string command = _cmw.Popup(selectedItems, pt); switch (command) { case "open": OpenCommand.Execute(null); break; case "openas": OpenCommand.Execute(null); break; case "rename": RenameCommand.Execute(null); break; case "refresh": RefreshCommand.Execute(null); break; } } }; #endregion #region Delete, Copy and Paste DeleteCommand = new SimpleRoutedCommand(ApplicationCommands.Delete) { CanExecuteDelegate = x => { if (getSelectionFunc() != null && getSelectionFunc().Length > 0) { ; } { var selectedItems = (from model in getSelectionFunc() select model.EmbeddedEntry).ToArray(); foreach (FileSystemInfoEx item in selectedItems) { if ((item.Attributes & FileAttributes.ReadOnly) != 0) { return(false); } } return(true); } //return false; }, ExecuteDelegate = x => { var selectedItems = (from model in getSelectionFunc() select model.EmbeddedEntry).ToArray(); int itemCount = selectedItems.Length; if (System.Windows.Forms.MessageBox.Show(String.Format("Are you sure want to permanently remove these {0} item{1}?", itemCount, itemCount > 1 ? "s" : ""), "Delete", System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) { foreach (FileSystemInfoEx item in selectedItems) { item.Delete(); } } } }; CopyCommand = new SimpleRoutedCommand(ApplicationCommands.Copy) { CanExecuteDelegate = x => { return(getSelectionFunc() != null && getSelectionFunc().Length > 0); }, ExecuteDelegate = x => { var selectedItems = (from model in getSelectionFunc() select model.EmbeddedEntry).ToArray(); StringCollection fileList = new StringCollection(); foreach (FileSystemInfoEx item in selectedItems) { fileList.Add(item.FullName); } Clipboard.Clear(); Clipboard.SetFileDropList(fileList); } }; PasteCommand = new SimpleRoutedCommand(ApplicationCommands.Paste) { CanExecuteDelegate = x => { return (getCurrentFunc() != null && ((getCurrentFunc().EmbeddedDirectoryEntry.Attributes & FileAttributes.ReadOnly) != 0) && Clipboard.ContainsFileDropList()); }, ExecuteDelegate = x => { DirectoryInfoEx parentDir = getCurrentFunc().EmbeddedDirectoryEntry; List <FileSystemInfoEx> entryList = new List <FileSystemInfoEx>(); foreach (string path in Clipboard.GetFileDropList()) { IOTools.Copy(path, PathEx.Combine(parentDir.FullName, PathEx.GetFileName(path))); } } }; #endregion #region PropertiesCommand PropertiesCommand = new SimpleRoutedCommand(ApplicationCommands.Properties) { CanExecuteDelegate = x => { return(getSelectionFunc() != null && getSelectionFunc().Length > 0); }, ExecuteDelegate = x => { System.Windows.Point position = Mouse.GetPosition(null); var selectedItems = (from model in getSelectionFunc() select model.EmbeddedEntry).ToArray(); ContextMenuHelper.InvokeCommand(getSelectionFunc()[0].EmbeddedEntry.Parent, selectedItems, "properties", new System.Drawing.Point((int)position.X, (int)position.Y)); } }; #endregion }
protected virtual void tree_AfterNodeTextEdit(object sender, AfterNodeTextEditEventArgs e) { IMaxNode node = TreeMode.GetMaxNode(e.TreeNode); if (node == null) return; if (e.NewText != e.OldText) { RenameCommand cmd = new RenameCommand(new List<IMaxNode>(1) { node }, e.NewText); cmd.Execute(false); } //Note: setting treenode text to displayname and sorting are // handled by nodenamechanged callback. MaxInterfaces.Global.EnableAccelerators(); }
public void Execute(RenameCommand command) { command.ViewModel.BeginEditing(); }
public string Visit(RenameCommand command) { return(command.File.FullName); }
private void setupCommands() { ContextMenuCommand = new SimpleCommand() { ExecuteDelegate = (x) => { NavigationItemViewModel <FI, DI, FSI> vm = this; Point pt = UITools.GetScreenMousePosition(); switch (vm.ContextMenu(pt)) { case "open": if (OpenCommand != null) { OpenCommand.Execute(vm); } break; case "rename": if (RenameCommand != null) { RenameCommand.Execute(vm); } break; case "refresh": if (RefreshCommand != null) { RefreshCommand.Execute(vm); } break; } } }; OpenCommand = new SimpleCommand() { ExecuteDelegate = (x) => { Profile.Open(EmbeddedDirectoryModel); } }; RefreshCommand = new SimpleCommand() { CanExecuteDelegate = (x) => { return(_subDirectories != null && !_subDirectories.IsWorking); }, ExecuteDelegate = (x) => { Refresh(); } }; PropertiesCommand = new SimpleCommand() { ExecuteDelegate = x => { System.Windows.Point position = Mouse.GetPosition(null); Profile.ShowProperties(position, EmbeddedDirectoryModel); } }; RenameCommand = new SimpleCommand() { CanExecuteDelegate = (x) => { return(!this.EmbeddedDirectoryModel.IsReadonly); }, ExecuteDelegate = (x) => { EmbeddedDirectoryViewModel.IsEditing = true; } }; DeleteCommand = new SimpleCommand() { CanExecuteDelegate = (x) => { return(EmbeddedDirectoryModel.IsReadonly); }, ExecuteDelegate = (x) => { try { string caption = String.Format(Texts.strConfirmDelete, 1, ""); if (new WPFMessageBoxService().ShowYesNo(caption, CustomDialogIcons.Question) == CustomDialogResults.Yes) { Profile.Delete(EmbeddedDirectoryModel, EmbeddedDirectoryViewModel.EmbeddedDirectoryModel); } } catch (Exception ex) { new WPFMessageBoxService().ShowError(ex.Message); } } }; }
/// <summary> /// Initializes a new instance of the <see cref="RenameCommandBuilder"/> class. /// </summary> /// <param name="command">The command.</param> internal RenameCommandBuilder(ref RenameCommand command) { this.command = command; }
public void Execute(Message msg, IMessageSenderService sender, IBot bot) { if (Main.Api.Users.IsBanned(msg)) { return; } if (!Main.Api.Users.CheckUser(msg)) { var kb2 = new KeyboardBuilder(bot); kb2.AddButton("➕ Зарегистрироваться", "start"); sender.Text("❌ Вы не зарегистрированы, нажмите на кнопку ниже, чтобы начать", msg.ChatId, kb2.Build()); return; } var user = Main.Api.Users.GetUser(msg); var command = UsersCommandHelper.GetHelper().Get(user.Id); //TODO: написать с использованием команд-менеджера. var text = string.Empty; if (command == "") { if (msg.ChatId > 2000000000) { return; } sender.Text("❌ Неизвестная команда", msg.ChatId); return; } else if (command == "putrawmoney") { long count; try { count = long.Parse(msg.Text); text = PutCommand.PutMoney(user, count); } catch { text = "❌ Вы ввели неверное число. Попробуйте ещё раз."; } } else if (command == "withdrawmoney") { long count; try { count = long.Parse(msg.Text); text = WithdrawCommand.Withdraw(user, count); } catch { text = "❌ Вы ввели неверное число. Попробуйте ещё раз."; } } else if (command == "exchangedonate") { long count; try { count = long.Parse(msg.Text); text = ExchangeDonateCommand.Exchange(msg, count); }catch { text = "❌ Вы ввели неверное число. Попробуйте ещё раз."; } } else if (command == "creategang") { text = CreateCommand.Create(msg.Text, user.Id); } else if (command == "renamegang") { text = RenameCommand.Rename(user, msg.Text); } else if (command == "opencontribution") { try { var array = msg.Text.Split(" "); var count = long.Parse(array[0]); var days = long.Parse(array[1]); text = OpenContributionCommand.Open(user.Id, count, days); } catch { text = "❌ Вы указали неверные числа"; } } else if (command == "racefriend") { try { var array = msg.Text.Split(" "); var id = long.Parse(array[0]); text = RaceFriendCommand.RunFriendBattle(user.Id, id, sender, bot, msg); }catch { text = "Вы указали неверный id"; } } else if (command == "addfriend") { try { text = AddFriendCommand.AddFriend(user, msg.Text.ToLong(), sender); } catch { text = "❌ Вы указали неверный Id."; } } else if (command == "removefriend") { try { text = RemoveFriendCommand.RemoveFriend(user, msg.Text.ToLong()); } catch { text = "❌ Вы указали невеный Id."; } } else if (command == "sellcar") { try { var array = msg.Text.Split(" "); var idUser = long.Parse(array[0]); var price = long.Parse(array[1]); text = SellCarCommand.Sell(user, idUser, sender, price); }catch { text = "❌ Произошла ошибка."; } } else if (command == "buycarnumber") { try { var region = long.Parse(msg.Text); if (region < 1 || region > 999) { text = "❌ Регион находится за пределом допустимого значения."; } else { text = BuyCarNumberCommand.BuyNumber(user, region); } } catch { text = "❌ Произошла ошибка."; } } else if (command == "sellnumber") { try { var array = msg.Text.Split(" "); var idUser = long.Parse(array[0]); var price = long.Parse(array[1]); text = SellNumberCommand.Sell(user, idUser, sender, price); }catch { text = "❌ Произошла ошибка."; } } else if (command == "buychips") { try { var count = msg.Text.ToLong(); text = BuyChipsCommand.BuyChips(user, count); } catch { text = "❌ Произошла ошибка."; } } else if (command == "exchangechips") { try { var count = msg.Text.ToLong(); text = ExchangeChipsCommand.ExchangeChips(user, count); } catch { text = "❌ Произошла ошибка."; } } else if (command == "vipDonateBuy") { try { var count = msg.Text.ToLong(); text = ExpDonateCommand.BuyExp(count, user); } catch { text = "❌ Произошла ошибка."; } } else if (command == "carDonate") { try { text = CarDonateCommand.CreateCar(msg.Text, user); } catch { text = "❌ Произошла ошибка."; } } else if (command == "expDonate") { try { var array = msg.Text.Split(" "); var power = long.Parse(array[0]); var weight = long.Parse(array[1]); text = AcceptCustomCarCommand.SetParams(power, weight, user, sender); }catch { text = "❌ Произошла ошибка."; } } else if (command == "customNumber") { try { var number = msg.Text.ToLong(); text = BuyOtherItemCommand.CustomNumber(number.ToString(), user); } catch { text = "❌ Произошла ошибка."; } } else if (command == "chatSend") { try { var textMsg = msg.Text; text = ChatCommand.Send(textMsg, user, sender); } catch (Exception e) { text = $"❌ Произошла ошибка. {e}"; } } else if (command == "newChatCreate") { try { var number = msg.Text; text = NewChatCommand.CreateChat(number, user, sender, bot); } catch { text = "❌ Произошла ошибка."; } } var kb = new KeyboardBuilder(bot); kb.AddButton(ButtonsHelper.ToHomeButton()); sender.Text(text, msg.ChatId, kb.Build()); // UsersCommandHelper.GetHelper().Add("", user.Id); }
public void UpdateTemplate(string fileName, UpdateCommand[] cmds) { string destDir = TestHelper.GetTempDir(); try { CallbackTested tested = new CallbackTested(false); Directory.CreateDirectory(destDir); string srcWimFile = Path.Combine(TestSetup.SampleDir, fileName); string destWimFile = Path.Combine(destDir, fileName); File.Copy(srcWimFile, destWimFile, true); using (Wim wim = Wim.OpenWim(destWimFile, OpenFlags.WriteAccess, UpdateProgressCallback, tested)) { wim.UpdateImage(1, cmds, UpdateFlags.SendProgress); wim.Overwrite(WriteFlags.None, Wim.DefaultThreads); } List <string> entries = new List <string>(); int IterateCallback(DirEntry dentry, object userData) { entries.Add(dentry.FullPath); return(Wim.IterateCallbackSuccess); } using (Wim wim = Wim.OpenWim(destWimFile, OpenFlags.None)) { wim.IterateDirTree(1, Wim.RootPath, IterateDirTreeFlags.Recursive, IterateCallback, entries); } Assert.IsTrue(tested.Value); foreach (UpdateCommand cmd in cmds) { switch (cmd.Op) { case UpdateOp.Add: { AddCommand add = cmd.Add; Assert.IsTrue(entries.Contains(Path.Combine(Wim.RootPath, add.WimTargetPath), StringComparer.Ordinal)); } break; case UpdateOp.Delete: { DeleteCommand del = cmd.Delete; Assert.IsFalse(entries.Contains(Path.Combine(Wim.RootPath, del.WimPath), StringComparer.Ordinal)); } break; case UpdateOp.Rename: { RenameCommand ren = cmd.Rename; Assert.IsTrue(entries.Contains(Path.Combine(Wim.RootPath, ren.WimTargetPath), StringComparer.Ordinal)); } break; } } } finally { if (Directory.Exists(destDir)) { Directory.Delete(destDir, true); } } }
public string TestRename(string original, string prefix, string baseName, string suffix, long numericSuffix = -1) { return(RenameCommand.Rename(original, prefix, baseName, suffix, numericSuffix)); }
private async Task Handle(RenameCommand message) { Console.WriteLine("MyPersistenceActor - RenameCommand"); await Persistence.PersistEventAsync(new RenameEvent { Name = message.Name }); }
protected virtual void setupCommands() { ContextMenuCommand = new SimpleCommand() { CanExecuteDelegate = (x) => { ViewerBaseVM vm = (x as ViewerBaseVM); return(vm.IsContextMenuEnabled); }, ExecuteDelegate = (x) => { ViewerBaseVM vm = (x as ViewerBaseVM); if (vm.IsContextMenuEnabled) { Point pt = UITools.GetScreenMousePosition(); switch (vm.ContextMenu(pt)) { case "open": if (ExpandCommand != null) { ExpandCommand.Execute(vm); } break; case "rename": if (RenameCommand != null) { RenameCommand.Execute(vm); } break; case "refresh": if (RefreshCommand != null) { RefreshCommand.Execute(vm); } break; } } } }; RefreshCommand = new SimpleCommand() { ExecuteDelegate = (x) => { Refresh(); } }; //ExpandCommand = new SimpleCommand() //{ // CanExecuteDelegate = // (x) => // { // ViewerBaseViewModel<FI, DI, FSI> vm = (x as ViewerBaseViewModel<FI, DI, FSI>); // return vm == null ? false : vm.CanExpand; // }, // ExecuteDelegate = // (x) => // { // ViewerBaseViewModel<FI, DI, FSI> vm = (x as ViewerBaseViewModel<FI, DI, FSI>); // vm.Expand(); // } //}; }
public void Execute(RenameCommand renameCommand) { var request = new Core.Boundaries.Rename.Request(renameCommand.Id, renameCommand.NewTitle); renameUseCase.Execute(request); }