Ejemplo n.º 1
0
        public void ShowCode(Code _selectCode)
        {
            if (_selectCode == null)
            {
                return;
            }
            var frm = new FormCodeEditor(this.m_dbName);

            frm.code = _selectCode;
            frm.Text = _selectCode.Title;
            if (!String.IsNullOrEmpty(_selectCode.TreeId))
            {
                var codeTree = db.GetFolder(_selectCode.TreeId);
                if (codeTree == null)
                {
                    codeTree = SelectedFolder;
                }
                if (codeTree != null)
                {
                    frm.TreeId   = codeTree.Id;
                    frm.TreeText = codeTree.Text;
                }
            }

            //frm.Show();
            if (this.DockPanel != null)
            {
                frm.Show(this.DockPanel);
            }
        }
Ejemplo n.º 2
0
        void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex < 0 || e.RowIndex < 0)
            {
                return;
            }
            var cell = dataGridView1[e.ColumnIndex, e.RowIndex];

            if (cell != null && cell.Value != null)
            {
                this.syntaxBoxControl1.Document.Text = cell.Value.ToString();

                if (!string.IsNullOrWhiteSpace(cell.Value.ToString()))
                {
                    if (dt.Columns[e.ColumnIndex].ColumnName == "CodeId")
                    {
                        try
                        {
                            Code code = new Codedb().GetCode(cell.Value.ToString());
                            if (code != null)
                            {
                                FormCodeEditor frm = new FormCodeEditor();
                                frm.code = code;
                                frm.Show();
                            }
                        }
                        catch (Exception ee)
                        {
                            MessageBox.Show(ee.Message);
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
        private void toolStripMenuItemEditCode_Click(object sender, EventArgs e)
        {
            var selectItem = listBox1.SelectedItem as Code;

            if (selectItem != null)
            {
                var frm = new FormCodeEditor();
                frm.code = selectItem;
                frm.Show();
            }
        }
Ejemplo n.º 4
0
        private void NewCode()
        {
            var _code_new = new Code();

            _code_new.Version = "1.0.0";
            _code_new.Title   = "NewCode*";
            var codeEditor = new FormCodeEditor(this.DbName);

            if (this.DockPanel != null)
            {
                codeEditor.Show(this.DockPanel);
            }
        }
        void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.ColumnIndex < 0 || e.RowIndex < 0)
                {
                    return;
                }
                var cell  = dataGridView1[e.ColumnIndex, e.RowIndex];
                var cell2 = dataGridView1["NAME", e.RowIndex];
                if (cell != null && cell.Value != null)
                {
                    this.syntaxBoxControl1.Document.Text = cell.Value.ToString();

                    if (!string.IsNullOrWhiteSpace(cell.Value.ToString()))
                    {
                        if (dt.Columns[e.ColumnIndex].ColumnName == "CodeId")
                        {
                            try
                            {
                                Code code = new Codedb().GetCode(cell.Value.ToString());
                                if (code != null)
                                {
                                    FormCodeEditor frm = new FormCodeEditor();
                                    frm.code = code;
                                    frm.Show();
                                }
                            }
                            catch (Exception ee)
                            {
                                MessageBox.Show(ee.Message);
                            }
                        }
                        else if (dt.Columns[e.ColumnIndex].ColumnName == "NAME")
                        {
                            var x   = LoadOneObject(cell.Value.ToString());
                            var arr = x.Split(new string[] { "\r\n" }, StringSplitOptions.None);
                            dataGridView1["Header", e.RowIndex].Value = x;
                            dataGridView1["Lines", e.RowIndex].Value  = arr.Count();
                            dataGridView1["Length", e.RowIndex].Value = Util.FileUtil.FormatFileSize(x.Length);
                            this.syntaxBoxControl1.Document.Text      = x;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 6
0
        private void CopytoolStripButton2_Click(object sender, EventArgs e)
        {
            if (_code != null)
            {
                var _code_copy = new Code();
                _code_copy    = _code;
                _code_copy.Id = "";
                //_code_copy.TreeId = _code.TreeId;

                var codeEditor = new FormCodeEditor(this.DbName);
                codeEditor.code = _code_copy;
                if (this.DockPanel != null)
                {
                    codeEditor.Show(this.DockPanel);
                }
            }
        }
Ejemplo n.º 7
0
 private void editCode(String id)
 {
     try
     {
         Code code = codedb.GetCode(id);
         if (code != null)
         {
             FormCodeEditor frm = new FormCodeEditor();
             frm.code = code;
             frm.Show();
         }
     }
     catch (Exception ee)
     {
         MessageBox.Show(ee.Message);
     }
 }
Ejemplo n.º 8
0
        void listBox1_DoubleClick(object sender, EventArgs e)
        {
            if (listBox1.SelectedItems.Count == 0)
            {
                return;
            }

            CodeFolder _codeFolder = null;

            if (treeView1.SelectedNode != null)
            {
                _codeFolder = treeView1.SelectedNode.Tag as CodeFolder;

                if (_codeFolder != null)
                {
                    this.SelectedFolder = _codeFolder;
                }
            }

            if (this.SelectedFolder == null)
            {
                MessageBox.Show("没有选中的文件夹");
                return;
            }
            _codeFolder = SelectedFolder;

            var _selectCode = listBox1.SelectedItem as Code;


            var list = listBox1.DataSource as List <Code>;

            if (_selectCode != null)
            {
                this.SelectedCode = _selectCode;
                IDockContent content = FindDocument(_selectCode.Title);
                if (content == null)
                {
                    var frm = new FormCodeEditor(this.m_dbName);

                    frm.code = _selectCode;
                    frm.Text = _selectCode.Title;
                    if (_codeFolder != null)
                    {
                        frm.TreeId   = _codeFolder.Id;
                        frm.TreeText = _codeFolder.Text;
                    }
                    //frm.Show();
                    if (this.DockPanel != null)
                    {
                        frm.Show(this.DockPanel);
                    }
                }
                else
                {
                    content.DockHandler.Activate();
                }
            }
            var newCode = db.GetCode(_selectCode.Id);

            if (newCode != null)
            {
                this.toolStripStatusLabel1.Text = string.Empty;
                if (newCode.Content.Length > 3 * 1024 * 1024)
                {
                    this.toolStripStatusLabel1.Text = "文件太大,无法显示";
                    // MessageBox.Show("文件太大,无法显示");
                    return;
                }
                if (this.splitContainer3.Panel2Collapsed == false)
                {
                    syntaxBoxControl1.Document.Text = newCode.Content;
                    // this.textBox1.Text = newCode.Content;
                    webBrowser1.DocumentText = newCode.Content;
                }
            }
            else
            {
                //updateTreeNode(treeView1.SelectedNode);
                list.Remove(_selectCode);
                listBox1.DataSource    = null;
                listBox1.DataSource    = list;
                listBox1.DisplayMember = "Title";

                syntaxBoxControl1.Document.Text = string.Empty;
                //  this.textBox1.Text = string.Empty;
                webBrowser1.DocumentText = string.Empty;
            }
        }
        private void editCode(String id)
        {
            try
            {
                Code code = codedb.GetCode(id);
                if (code != null)
                {
                    FormCodeEditor frm = new FormCodeEditor();
                    frm.code = code;
                    frm.Show();
                }
            }
            catch (Exception ee)
            {

                MessageBox.Show(ee.Message);
            }
        }
        void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex < 0 || e.RowIndex < 0)
            {
                return;
            }
            var cell = dataGridView1[e.ColumnIndex, e.RowIndex];
            if (cell != null && cell.Value != null)
            {
                this.syntaxBoxControl1.Document.Text = cell.Value.ToString();

                if (!string.IsNullOrWhiteSpace(cell.Value.ToString()))
                {

                    if (dt.Columns[e.ColumnIndex].ColumnName == "CodeId")
                    {
                        try
                        {
                            Code code = new Codedb().GetCode(cell.Value.ToString());
                            if (code != null)
                            {
                                FormCodeEditor frm = new FormCodeEditor();
                                frm.code = code;
                                frm.Show();
                            }
                        }
                        catch (Exception ee)
                        {

                            MessageBox.Show(ee.Message);
                        }
                    }
                }
            }
        }
Ejemplo n.º 11
0
 private void btnCodeEditor_Click(object sender, EventArgs e)
 {
     CodeManager.FormCodeEditor frm = new CodeManager.FormCodeEditor();
     frm.Show();
 }
 private void NewCode()
 {
     var _code_new = new Code();
     _code_new.Version = "1.0.0";
     _code_new.Title = "NewCode*";
     var codeEditor = new FormCodeEditor(this.DbName);
     if (this.DockPanel != null)
     {
         codeEditor.Show(this.DockPanel);
     }
 }
        private void CopytoolStripButton2_Click(object sender, EventArgs e)
        {
            if (_code != null)
            {
                var _code_copy = new Code();
                _code_copy = _code;
                _code_copy.Id = "";
                //_code_copy.TreeId = _code.TreeId;

                var codeEditor = new FormCodeEditor(this.DbName);
                codeEditor.code = _code_copy;
                if (this.DockPanel != null)
                {
                    codeEditor.Show(this.DockPanel);
                }
            }
        }
Ejemplo n.º 14
0
        private void MenuItemNewAbapDoc_Click(object sender, EventArgs e)
        {
            //var abapDoc = CreateAbapDoc();
            //if (dockPanel.DocumentStyle == DocumentStyle.SystemMdi)
            //{
            //    abapDoc.MdiParent = this;
            //    abapDoc.Show();
            //}
            //else
            //    abapDoc.Show(dockPanel);

            m_FormCodeEditor = new FormCodeEditor();
            m_FormCodeEditor.Show(dockPanel);
        }
        void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.ColumnIndex < 0 || e.RowIndex < 0)
                {
                    return;
                }
                var cell = dataGridView1[e.ColumnIndex, e.RowIndex];
                var cell2 = dataGridView1["NAME", e.RowIndex];
                if (cell != null && cell.Value != null)
                {
                    this.syntaxBoxControl1.Document.Text = cell.Value.ToString();

                    if (!string.IsNullOrWhiteSpace(cell.Value.ToString()))
                    {

                        if (dt.Columns[e.ColumnIndex].ColumnName == "CodeId")
                        {
                            try
                            {
                                Code code = new Codedb().GetCode(cell.Value.ToString());
                                if (code != null)
                                {
                                    FormCodeEditor frm = new FormCodeEditor();
                                    frm.code = code;
                                    frm.Show();
                                }
                            }
                            catch (Exception ee)
                            {

                                MessageBox.Show(ee.Message);
                            }
                        }
                        else if (dt.Columns[e.ColumnIndex].ColumnName == "NAME")
                        {
                            var x = LoadOneObject(cell.Value.ToString());
                            var arr = x.Split(new string[] { "\r\n" }, StringSplitOptions.None);
                            dataGridView1["Header", e.RowIndex].Value = x;
                            dataGridView1["Lines", e.RowIndex].Value = arr.Count();
                            dataGridView1["Length", e.RowIndex].Value = Util.FileUtil.FormatFileSize(x.Length);
                            this.syntaxBoxControl1.Document.Text = x;
                        }
                    }
                }
            }
            catch (Exception ex)
            {

                MessageBox.Show(ex.Message);
            }
        }
 private void btnCodeEditor_Click(object sender, EventArgs e)
 {
     CodeManager.FormCodeEditor frm = new CodeManager.FormCodeEditor();
     frm.Show();
 }