public static void CreateRenameWindow(string panel, string oldName) { var mainWin = Application.Current.Windows.Cast <Window>().FirstOrDefault(window => window is MainWindow) as MainWindow; string ActionName = ((ComboBox)mainWin.FindName("ActionsBox")).SelectedItem.ToString().Split(new string[] { ": " }, StringSplitOptions.None).Last();; RenameWindow rw = new RenameWindow(); rw.RenameBox.Text = oldName; rw.Show(); rw.RenameButton.Click += (i, e) => { string newName = rw.RenameBox.Text; switch (panel) { case "ActionsBox": Scheme.Scheme.RenameAction(oldName, newName); break; case "AtributesBox": Scheme.Scheme.RenameAtribute(ActionName, oldName, newName); break; default: break; } mainWin.IsEnabled = true; rw.Close(); }; }
public static void Create() { RuntimeAnimatorController selectedAnimatorController = Selection.activeObject as AnimatorController; if (selectedAnimatorController == null) { return; } RenameWindow renameWindow = EditorWindow.GetWindow <RenameWindow>("Create Nested Animation"); renameWindow.CaptionText = "New Animation Name"; renameWindow.NewName = "New Clip"; renameWindow.ButtonText = "Create"; renameWindow.OnClickButton = (string newName) => { if (string.IsNullOrEmpty(newName)) { return; } AnimationClip animationClip = AnimatorController.AllocateAnimatorClip(newName); AssetDatabase.AddObjectToAsset(animationClip, selectedAnimatorController); AssetDatabase.ImportAsset( AssetDatabase.GetAssetPath(selectedAnimatorController)); }; }
private void RenameMod_Button_Click(object sender, RoutedEventArgs e) { renaming = true; RenameWindow.RenameComplete += RenameWindow_RenameComplete; renameWindow = new RenameWindow(); renameWindow.Closed += Rename_Closed; renameWindow.Show(); }
public void Rename(Database db) { this.db = db; RenameView view = new RenameView(this); RenameWindow window = new RenameWindow(view); var resDlg = Application.ShowModalWindow(window); }
private void RenameTacticButton_Click(object sender, RoutedEventArgs e) { RenameWindow renameWindow = new RenameWindow(); if (renameWindow.ShowDialog() == true) { (this.TacticsList.SelectedItem as Tactic).Name = renameWindow.NewName; } }
void RenameCalled(object val) { var data = (KeyValuePair <string, string>)val; RenameWindow window = EditorWindow.GetWindow <RenameWindow>(); mRenameWindow = window; if (data.Key == "category") { window.ShowDialog(data.Value, data.Key, RenameCategory); } }
void OnDisable() { if (mRenameWindow != null) { mRenameWindow.Close(); mRenameWindow = null; } if (mWindow != null) { mWindow.Close(); mWindow = null; } }
public static void Create() { // Projectビューで選択されているアニメーターコントローラーを取得する AnimatorController selectedAnimatorController = Selection.activeObject as AnimatorController; // アニメーターコントローラーが選択されていなければエラー if (selectedAnimatorController == null) { Debug.LogWarning("No animator controller selected."); return; } // 作成するアニメーションクリップの名前を入力するダイアログを開く RenameWindow renameWindow = EditorWindow.GetWindow <RenameWindow>("Create Nested Animation"); renameWindow.CaptionText = "New Animation Name"; renameWindow.NewName = "New Clip"; renameWindow.ButtonText = "Create"; // ダイアログのボタンが押されたら呼ばれるメソッドのデリゲート renameWindow.OnClickButtonDelegate = (string newName) => { if (string.IsNullOrEmpty(newName)) { Debug.LogWarning("Invalid name."); return; } // ダイアログで入力された名前でアニメーションクリップを作成する AnimationClip animationClip = AnimatorController.AllocateAnimatorClip(newName); // 選択されたアニメーターコントローラーのサブアセットとして // 作成したアニメーションクリップを追加する AssetDatabase.AddObjectToAsset(animationClip, selectedAnimatorController); // アニメーターコントローラーをインポートし直して変更を反映する AssetDatabase.ImportAsset( AssetDatabase.GetAssetPath(selectedAnimatorController)); }; }
public static void Create() { // 프로젝트 Project 뷰에서 선택된선택되어 있는 애니메이터 컨트롤러를 가져온다 AnimatorController selectedAnimatorController = Selection.activeObject as AnimatorController; // 애니메이터 컨트롤러가 선택돼선택되어 있지 않으면 오류 if (selectedAnimatorController == null) { Debug.LogWarning("No animator controller selected."); return; } // 생성할 애니메이션 클립의 이름을 입력할 대화상자를 연다 RenameWindow renameWindow = EditorWindow.GetWindow <RenameWindow>("Create Nested Animation"); renameWindow.CaptionText = "New Animation Name"; renameWindow.NewName = "New Clip"; renameWindow.ButtonText = "Create"; // 대화상자에 있는 버튼을 누르면이 눌러지면 호출되는 메서드의 델리게이트 renameWindow.OnClickButtonDelegate = (string newName) => { if (string.IsNullOrEmpty(newName)) { Debug.LogWarning("Invalid name."); return; } // 대화상자에 입력된 이름으로 애니메이션 클립을 생성한다 AnimationClip animationClip = AnimatorController.AllocateAnimatorClip(newName); // 선택된 애니메이터 컨트롤러의 서브트 에셋의 형태로 // 생성된 애니메이션 클립을 추가한다 AssetDatabase.AddObjectToAsset(animationClip, selectedAnimatorController); // 애니메이터 컨트롤러를 다시 임포트해서 변경 사항을 반영한시킨다 AssetDatabase.ImportAsset( AssetDatabase.GetAssetPath(selectedAnimatorController)); }; }
private static IDisposable ShowRenameWindow() { var current = VirtualDesktop.Current; int number = DesktopHelper.GetNumber(current); var source = new CancellationTokenSource(); var vmodel = new RenameWindowViewModel { Number = number, }; var window = new RenameWindow(MonitorService.GetCurrentArea().WorkArea) { DataContext = vmodel, }; window.Show(); Task.Delay(TimeSpan.FromMilliseconds(30000), source.Token) .ContinueWith(_ => window.Close(), TaskScheduler.FromCurrentSynchronizationContext()); return(Disposable.Create(() => source.Cancel())); }
private void btnRenameFile_Click(object sender, RoutedEventArgs e) { FormattedGrepResult searchResult = null; var node = inputData.SelectedNodes.FirstOrDefault(); if (node is FormattedGrepLine lineNode) { searchResult = lineNode.Parent; } else if (node is FormattedGrepResult fileNode) { searchResult = fileNode; } if (searchResult != null && searchResult.GrepResult != null && !string.IsNullOrEmpty(searchResult.GrepResult.FileNameReal)) { var grepResult = searchResult.GrepResult; var dlg = new RenameWindow { Owner = Application.Current.MainWindow, SourcePath = grepResult.FileNameReal }; var result = dlg.ShowDialog(); if (result.HasValue && result.Value) { string destPath = dlg.DestinationPath; if (!string.IsNullOrEmpty(destPath) && !File.Exists(destPath)) { try { string ext = string.Empty; if (grepResult.FileNameReal != grepResult.FileNameDisplayed) { int index = grepResult.FileNameDisplayed.IndexOf(grepResult.FileNameReal, StringComparison.Ordinal); if (index >= 0) { ext = grepResult.FileNameDisplayed.Remove(index, grepResult.FileNameReal.Length); } } File.Move(grepResult.FileNameReal, destPath); grepResult.FileNameReal = destPath; grepResult.FileNameDisplayed = destPath + ext; // update label in the results tree searchResult.SetLabel(); // update label on the preview window OnSelectedItemsChanged(this, e); } catch (Exception ex) { MessageBox.Show("Rename failed: " + ex.Message, "Rename File", MessageBoxButton.OK, MessageBoxImage.Error); } } } } }
/* * */ private void renameClick(object sender, RoutedEventArgs e) { RenameWindow win = new RenameWindow(mainWindow.pageTreeColumn, rightClickPageId); win.ShowDialog(); }
public static void Renamer() { RenameWindow window = GetWindow <RenameWindow>("Objects Renamer"); window.minSize = new Vector2(200, 245); }
private void Rename() { if (null != _selectedClient) { var client = _selectedClient; var renameWindow = new RenameWindow(); renameWindow.RenameGroupBox.Header = client.IPAddress; renameWindow.HostNameTextBox.Text = client.HostName; if (renameWindow.ShowDialog() == true) { var hostname = renameWindow.HostNameTextBox.Text; var buffer = Encoding.UTF8.GetBytes(hostname); var dst = new byte[buffer.Length + 4]; var flag = Constants.MODIFY_HOSTNAME_FLAG; SetFlag(dst, flag, 0); Buffer.BlockCopy(buffer, 0, dst, 4, buffer.Length); buffer = null; _tcpServer.SendTo(client.Channel, dst); client.HostName = hostname; dst = null; } } }