Наследование: IDisposable
Пример #1
0
        public void Open(FarsiLibrary.Win.FATabStrip faTabStripMain, string path="")
        {
            using (OpenFileDialog ofd = new OpenFileDialog())
            {
                if (string.IsNullOrEmpty(path))
                {
                    ofd.Filter = "PList(*.plist)|*.plist|All files|*.*";
                    if (ofd.ShowDialog() == DialogResult.OK)
                    {
                        path = ofd.FileName;
                    }
                }
                if (!string.IsNullOrEmpty(path))
                {
                    try
                    {
                        PlistInfo p = new PlistInfo(path);
                        bool suc = p.Read();
                        CreateTab(faTabStripMain, p.Info.Name, p);

                        if (!suc)
                        {
                            MessageBox.Show("Xml format error");
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                        Debug.WriteLine(ex);
                    }
                }
            }
        }
Пример #2
0
 public void Open(FarsiLibrary.Win.FATabStrip faTabStripMain, string path = "")
 {
     using (OpenFileDialog ofd = new OpenFileDialog())
     {
         if (string.IsNullOrEmpty(path))
         {
             ofd.Filter = "PList(*.plist)|*.plist|All files|*.*";
             if (ofd.ShowDialog() == DialogResult.OK)
             {
                 path = ofd.FileName;
             }
         }
         if (!string.IsNullOrEmpty(path))
         {
             try
             {
                 PlistInfo p   = new PlistInfo(path);
                 bool      suc = p.Read();
                 CreateTab(faTabStripMain, p.Info.Name, p);
                 string[] values = path.Split('.');
                 if (String.Compare("cookie", values[values.Length - 1].Trim()) != 0 && !suc)
                 {
                     MessageBox.Show("Xml format error");
                 }
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.Message);
                 Debug.WriteLine(ex);
             }
         }
     }
 }
Пример #3
0
        public PlistEditControl(FATabStrip tabStrip, string title, PlistInfo p = null)
        {
            Editor = new TextEditorControl();
            Tab = new FATabStripItem();
            Tab.Title = title;
            Tab.Controls.Add(Editor);
            Editor.Dock = DockStyle.Fill;
            if (p == null)
            {
                p = new PlistInfo();
            }
            Pinfo = p;
            Editor.Text = p.Content;
            Editor.SetHighlighting("XML");
            Editor.TextChanged += Editor_TextChanged;

            tabStrip.AddTab(Tab);
            Saved = true;
        }
Пример #4
0
 public PlistEditControl(FATabStrip tabStrip, string title, PlistInfo p = null)
 {
     Editor    = new TextEditorControl();
     Tab       = new FATabStripItem();
     Tab.Title = title;
     Tab.Controls.Add(Editor);
     Editor.Dock = DockStyle.Fill;
     if (p == null)
     {
         p = new PlistInfo();
     }
     Pinfo       = p;
     Editor.Text = p.Content;
     Editor.SetHighlighting("XML");
     Editor.TextChanged += Editor_TextChanged;
     Editor.IsReadOnly   = true;
     tabStrip.AddTab(Tab);
     Saved = true;
 }
Пример #5
0
 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;
 }
Пример #6
0
        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);
        }