Beispiel #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);
            }
        }
Beispiel #2
0
        void updateDbConnect()
        {
            try
            {
                db = new Codedb(m_dbName);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message + e.Source + e.StackTrace);
                return;
            }



            initTree();
            loaded = true;


            if (this.TempFolder == null)
            {
                var tempFolderId = "b3dc4971-935c-49fb-a061-c9e01956d41d";

                TempFolder = db.GetFolder(tempFolderId);
                var v_root = db.GetRootFolder();
                if (v_root != null)
                {
                    if (TempFolder == null && !string.IsNullOrEmpty(v_root.Id))
                    {
                        TempFolder = db.SaveTree(new CodeFolder(tempFolderId, db.GetRootFolder().Id, "Temp", ""));
                    }
                }
            }
        }
Beispiel #3
0
 private void RefreshDisplay()
 {
     try
     {
         if (_code == null)
         {
             this.toolStripStatusLabel4.Text = string.Empty;
             this.toolStripStatusLabel5.Text = string.Empty;
             this.toolStripStatusLabel6.Text = string.Empty;
             this.txtDesc.Text = string.Empty;
             this.syntaxBoxControl1.Document.Text = string.Empty;
             this.txtTitle.Text    = string.Empty;
             this.cbxCategory.Text = string.Empty;
         }
         else
         {
             this.toolStripStatusLabel6.Text = _code.Version;
             this.toolStripStatusLabel5.Text = _code.LastChangeTime.ToShortDateString() + " " + _code.LastChangeTime.ToShortTimeString();
             this.toolStripStatusLabel4.Text = _code.CreateTime.ToShortDateString() + " " + _code.CreateTime.ToShortTimeString();
             this.txtDesc.Text = _code.Desc;
             this.syntaxBoxControl1.Document.Text = _code.Content;
             this.txtTitle.Text = _code.Title;
             if (!string.IsNullOrEmpty(_code.TreeId))
             {
                 var codeFolder = db.GetFolder(_code.TreeId);
                 if (codeFolder != null)
                 {
                     this.txtTreeText.Text = codeFolder.Text;
                     this.TreeId           = codeFolder.Id;
                 }
             }
             if (String.IsNullOrEmpty(_code.Category))
             {
                 _code.Category = "abap";
             }
             this.cbxCategory.Text = _code.Category;
             loadSynFile(_code.Category);
             this.Text = _code.Title;
             this.SatustoolStripLabel1.Text = "保存成功";
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }