Beispiel #1
0
 private void tmiCloseJsonFile_Click(object sender, EventArgs e)
 {
     selectedTable  = null;
     selectedLine   = null;
     selectedColumn = null;
     RefreshPnlFileInfoUI();
     RefreshPnlMainUI();
     RefreshLibLinesUI();
 }
Beispiel #2
0
 private void tmiOpenJsonFile_Click(object sender, EventArgs e)
 {
     selectedTable  = tables[trvJsonFiles.SelectedNode.Tag.ToString()];
     selectedLine   = null;
     selectedColumn = null;
     RefreshPnlFileInfoUI();
     RefreshPnlMainUI();
     RefreshLibLinesUI();
 }
Beispiel #3
0
 private void tmiCloseAllJsonFiles_Click(object sender, EventArgs e)
 {
     tables = null;
     if (jfi != null)
     {
         jfi.Dispose();
     }
     rootNode       = null;
     selectedColumn = null;
     selectedTable  = null;
     selectedLine   = null;
     RefreshJsonFilesUI();
     RefreshPnlFileInfoUI();
     RefreshLibLinesUI();
     RefreshPnlMainUI();
     sslMain.Text = "";
 }
Beispiel #4
0
        private void trvJsonFiles_AfterLabelEdit(object sender, NodeLabelEditEventArgs e)
        {
            if (e.Label == null || e.Label == e.Node.Text)
            {
                e.CancelEdit = true;
                return;
            }
            else if (e.Label.Trim() == "")
            {
                MessageBox.Show("不能為空字串", "錯誤", MessageBoxButtons.OK, MessageBoxIcon.Error);
                e.CancelEdit = true;
                return;
            }

            try
            {
                JTable tb = tables[e.Node.Tag.ToString()];
                tables.Remove(e.Node.Tag.ToString());
                tb.Name    = e.Label;
                e.Node.Tag = e.Label;
                tables.Add(e.Label, tb);
                File.Move(Path.Combine(jfi.DirectoryPath, $"{e.Node.Text}.json"), Path.Combine(jfi.DirectoryPath, $"{e.Label}.json"));

                //if (File.Exists(Path.Combine(jfi.DirectoryPath, linkFileName)))
                //{
                //    JFilesInfo jfi2;
                //    using (FileStream fs = new FileStream(Path.Combine(jfi.DirectoryPath, linkFileName), FileMode.Open))
                //    {
                //        StreamReader sr = new StreamReader(fs);
                //        jfi2 = JsonConvert.DeserializeObject<JFilesInfo>(sr.ReadToEnd());

                //        tb.LoadFileInfo()
                //        //jfi.DirectoryPath = fbdMain.SelectedPath;
                //    }
                //}
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, ex.HResult.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }