public void AddItem() { InputTextDialog.Open( delegate(byte[] bts) { //创建文件夹 IoBuffer ib = new IoBuffer(); ib.PutBytes(bts); string inputFieldText = ib.GetString(); if (!BeFolderOpen) { OpenFolder(); //没打开的先打开再创建,否则位置错乱 } var ti = TreeItem.Create(inputFieldText, this, MyTreeContainer); //nafio add 170623 这段代码有点冗余应该赋值一次就可以,类似重复的代码也需要整理下 // if (null != MyMenuList.CurSelItem && // !MyMenuList.CurSelItem.Equals (ti)) // { // MyMenuList.CurSelItem.DeSelect(); // } ti.TreeItemID = GEditorRoot.GetIns().KVContainerDic[MyTreeContainer.Name].CreateKVList(MyTreeContainer.Name); MyTreeContainer.CurSelItem = ti; //ti.OnSelect (); Log.i("TreeFolder", "AddItem", "新建item name:" + inputFieldText + " id:" + ti.TreeItemID, BeShowLog); } ); }
public void Show() { var dialog = new InputTextDialog(); if (dialog.ShowDialog() == DialogResult.OK) { string text = dialog.EnteredText; } }
public static string ShowTextInputDialog(Form owner, string title, string labelText, string inputText) { using InputTextDialog inputTextDialog = new InputTextDialog { Text = title, LabelName = { Text = labelText }, TextBoxName = { Text = inputText } }; return(inputTextDialog.ShowDialog(owner) == DialogResult.OK ? inputTextDialog.TextBoxName.Text.Trim() : null); }
public static string InputDialog(string text, string title, string message = "", string extraInfo = null) { var dialog = new InputTextDialog { Title = title, TextField = { Text = text }, MessageField = { Text = message }, ExtraInfoField = { Text = extraInfo }, }; var showDialog = dialog.ShowDialog(); return(showDialog == true ? dialog.MessageField.Text : null); }
/// <summary> /// Open input text dialog. /// </summary> /// <returns>string option name or empty string otherwise.</returns> public string OpenInputTextDialog() { // Instantiate the dialog box InputTextDialog dlg = new InputTextDialog(); // Open the dialog box modally if (dlg.ShowDialog() == true) { return(dlg.OptionNameResult); } return(""); }
private void AddItem() { InputTextDialog.Open( delegate(byte[] bts) { //创建文件夹 IoBuffer ib = new IoBuffer(); ib.PutBytes(bts); string name = ib.GetString(); string _itemID = GEditorRoot.GetIns().KVContainerDic[MyTreeContainer.Name].CreateKVList(MyTreeContainer.Name); var treeItem = InsertItem(IndexInParentFolder, name, ParentFolder, MyTreeContainer); treeItem.TreeItemID = _itemID; Log.i("TreeItem", "AddItem", "新建item name:" + name + " id:" + _itemID, BeShowLog); } ); }
/// <summary> /// 新增文件夹 /// </summary> public void AddFolder() { InputTextDialog.Open( delegate(byte[] bts) { //创建文件夹 IoBuffer ib = new IoBuffer(); ib.PutBytes(bts); string inputFieldText = ib.GetString(); if (!BeFolderOpen) { OpenFolder(); //没打开的先打开再创建,否则位置错乱 } TreeFolder.CreateSubFolder(inputFieldText, this, MyTreeContainer); } ); }
/// <summary> /// Open the specified callback, regular and info. /// </summary> /// <param name="callback">Callback.</param> /// <param name="regular">正则过滤字符串</param> /// <param name="info">如果输入不符合过滤,需要提示的信息</param> public static void Open(Listener <byte[]> callback, string title = "title", string info = "info", string regular = null, string warning = "") { var go = GameObject.Instantiate(Resources.Load("Prefabs/InputTextDialog")) as GameObject; go.transform.SetParent(GEditorRoot.GetIns().DialogPanel); var rt = go.GetComponent <RectTransform> (); rt.anchoredPosition = Vector2.zero; InputTextDialog dialog = go.GetComponent <InputTextDialog>(); dialog.FilterRegularStr = regular; dialog.WarningStr = info; dialog.Info.text = info; dialog.Title.text = title; dialog.Callback = callback; }
public void ReName() { //base.ReName (); InputTextDialog.Open( delegate(byte[] bts) { //创建文件夹 IoBuffer ib = new IoBuffer(); ib.PutBytes(bts); string newName = ib.GetString(); Name = newName;//这个名称不设置的化,当重命名后,再复制黏贴就出问题,显示的是未改名前的名称 ResizeTextRect(newName); //刷TreeContainer的W.这里w的算法,跟上面Create中一致 float _w = this.CurItemLeftOffset + UIEnum.ItemImageW + 4 + UIEnum.ItemImageW + Tools.GetStringW(this.ItemNameText.text, UIEnum.FontSize); MyTreeContainer.SetTreeW(_w); MyTreeContainer.RefreshTreeArea(); } ); }
public string GetInput(string prompt, bool hidden = false) { return(InputTextDialog.Input(prompt, hidden)); }