public void CreateNew(FarsiLibrary.Win.FATabStrip tabStrip) { string title = Res.NewPListTitle; PlistEditControl c = CreateTab(tabStrip, title); c.Editor.Text = Res.NewPListContent; }
internal void SetActivate(FATabStripItem tab) { if (controls.ContainsKey(tab)) { curEditor = controls[tab]; } }
internal void Save(PlistEditControl edit = null, bool saveAs = false, bool isBinaryFormat = false) { if (edit == null) { edit = curEditor; } if (edit == null) { return; } //正常打开的文件 if (!saveAs && !edit.Pinfo.IsTemp) { edit.Save(); } else { //新建或者另存为的文件 using (SaveFileDialog sfd = new SaveFileDialog()) { sfd.Filter = "PList(*.plist)|*.plist|All files|*.*"; if (sfd.ShowDialog() == DialogResult.OK) { edit.Save(isBinaryFormat, sfd.FileName); } } } }
private void CloseTab(FATabStripItem tab, bool goClose) { PlistEditControl edit = controls[tab]; edit.Pinfo.Dispose(); controls.Remove(tab); if (goClose) { ((FATabStrip)tab.Parent).RemoveTab(tab); } }
internal bool Close(TabStripItemClosingEventArgs e = null) { bool canClose = true; PlistEditControl edit = null; if (e == null) { edit = curEditor; } else { if (controls.ContainsKey(e.Item)) { edit = controls[e.Item]; } else { Debug.WriteLine("Err"); return(false); } } if (!edit.Saved) { DialogResult dr = MessageBox.Show("Save [" + edit.Tab.Title + "]", "Confirm Close", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); switch (dr) { case DialogResult.Cancel: if (e != null) { e.Cancel = true; } canClose = false; break; case DialogResult.No: CloseTab(edit.Tab, e == null); break; default: //Default Yes = Save first and close Save(edit); CloseTab(edit.Tab, e == null); break; } } else { CloseTab(edit.Tab, e == null); } return(canClose); }
private PlistEditControl CreateTab(FarsiLibrary.Win.FATabStrip tabStrip, string title, PlistInfo p = null) { PlistEditControl c = new PlistEditControl(tabStrip, title, p); if (controls.Count == 0 || p != null) { curEditor = c; tabStrip.SelectedItem = c.Tab; } c.Tab.ContextMenuStrip = ((FormMain)main).contextMenuStripTab; controls.Add(c.Tab, c); Drop.Bind(c.Tab); return(c); }
private PlistEditControl CreateTab(FarsiLibrary.Win.FATabStrip tabStrip, string title, PlistInfo p = null) { PlistEditControl c = new PlistEditControl(tabStrip, title, p); if (controls.Count == 0 || p!=null) { curEditor = c; tabStrip.SelectedItem = c.Tab; } c.Tab.ContextMenuStrip = ((FormMain)main).contextMenuStripTab; controls.Add(c.Tab, c); Drop.Bind(c.Tab); return c; }
internal void SetActivate(FATabStripItem tab) { if (controls.ContainsKey(tab)) { curEditor = controls[tab]; } }
internal void Save(PlistEditControl edit =null, bool saveAs = false, bool isBinaryFormat =false) { if (edit == null) { edit = curEditor; } if (edit == null) { return; } //正常打开的文件 if (!saveAs && !edit.Pinfo.IsTemp) { edit.Save(); } else { //新建或者另存为的文件 using (SaveFileDialog sfd = new SaveFileDialog()) { sfd.Filter = "PList(*.plist)|*.plist|All files|*.*"; if (sfd.ShowDialog() == DialogResult.OK) { edit.Save(isBinaryFormat, sfd.FileName); } } } }