Ejemplo n.º 1
0
        private TableConfigurator()
        {
            InitializeComponent();
            string fieldValueFormat = JSetting.ReadAppSetting("FieldValueFormat");

            if (!string.IsNullOrEmpty(fieldValueFormat))
            {
                string[] formats = fieldValueFormat.Trim().Split(',');
                if (formats.Length == 3)
                {
                    JTable.NumericFieldValueFormat  = formats[0];
                    JTable.StringFieldValueFormat   = formats[1];
                    JTable.DateTimeFieldValueFormat = formats[2];
                }
            }

            this.tableConfigCtrl1.FileChanged += this.OnFileChanged;
            this.LoadAction = (fileName) =>
            {
                this.tableConfigCtrl1.LoadFile(fileName);
                if (!string.IsNullOrEmpty(this.tableConfigCtrl1.TableSetting.ConnStr))
                {
                    this.ConnStr = this.tableConfigCtrl1.TableSetting.ConnStr;
                    this.ShowInStatus(this.ConnStr);
                }
            };
            this.SaveAction = (fileName) =>
            {
                this.tableConfigCtrl1.SaveFile(fileName, this.Extension);
            };
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Workbench wk = null;

            if (args != null && args.Length > 0)
            {
                wk = new Workbench(args);
            }
            else
            {
                wk = new Workbench();
            }
            try
            {
                bool enableFileLog = JSetting.ReadAppSetting("EnableFileLog").Value <bool>();
                if (enableFileLog)
                {
                    MessageSvc.Default.MessageReceived += MessageReceived;
                }

                MessageSvc.Default.MessageReceived += OutPutWindow.Instance.MessageReceived;

                Application.Run(wk);
            }
            catch (Exception ex)
            {
                JLog.Default.Write(LogMode.Error, ex);
            }
        }
Ejemplo n.º 3
0
        private void Workbench_Load(object sender, EventArgs e)
        {
            m_bSaveLayout       = JSetting.ReadAppSetting <bool>("SaveWindowLayout");
            notifyIcon1.Visible = JSetting.ReadAppSetting <bool>("ShowInNotifyArea");


            this.ShowMessage("addin【{0}】", AddinFileName);

            if (File.Exists(AddinFileName))
            {
                try
                {
                    addinConfig = SerializeHelper.XmlDeserializeFromFile <AddinConfig>(AddinFileName);

                    if (addinConfig != null && addinConfig.Tools != null)
                    {
                        foreach (var item in addinConfig.Tools)
                        {
                            if (!Assemblies.ContainsKey(item.DllFileName))
                            {
                                Assembly assembly = Assembly.Load(item.DllFileName);
                                Assemblies.Add(item.DllFileName, assembly);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    this.ShowMessage(ex);
                }
            }
            if (!specialFile) //加载上次打开的文件
            {
                string configFile = Path.Combine(Application.StartupPath, "DockPanel.config");
                try
                {
                    if (File.Exists(configFile))
                    {
                        dockPanel.LoadFromXml(configFile, m_deserializeDockContent);
                    }
                }
                catch
                {
                    File.Delete(configFile);
                }
            }
            else   //右键文件名,进行打开
            {
                OpenFileAccordingToFile(rightContextMenuFileName);
            }
            OutPutWin = OutPutWindow.Instance;
            OutPutWin.Show(dockPanel, DockState.DockBottom);

            dockPanel.ShowDocumentIcon = true;

            DynamicMenuGenerate();
        }
Ejemplo n.º 4
0
        void MdxExecutor_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (e.CloseReason == CloseReason.MdiFormClosing)
            {
                e.Cancel = true;
            }

            bool save = JSetting.ReadAppSetting <bool>("SaveFileWhenExit");

            if (save && (e.CloseReason == CloseReason.ApplicationExitCall || e.CloseReason == CloseReason.UserClosing))
            {
                this.mdxExecuterCtrl1.SaveFile(this.FileName, this.Extension);
            }
        }
Ejemplo n.º 5
0
        private void SaveToFile(List <MdxCodeSnip> list)
        {
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            var            form            = this.FindForm();

            saveFileDialog1.InitialDirectory = JSetting.ReadAppSetting("ConfigFileFolder");;
            saveFileDialog1.RestoreDirectory = true;
            saveFileDialog1.Filter           = "xml Files (.xml)|*.xml|All Files (*.*)|*.*";
            saveFileDialog1.FilterIndex      = 1;
            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                string fileName = saveFileDialog1.FileName;
                SerializeHelper.XmlSerializeToFile <List <MdxCodeSnip> >(list, fileName, true);
            }
        }
Ejemplo n.º 6
0
        //Open
        private void subItemOfOpen_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem tsItem = sender as ToolStripMenuItem;

            Justin.Core.MenuItem data = tsItem.Tag as Justin.Core.MenuItem;
            openFileDialog1.InitialDirectory = JSetting.ReadAppSetting("ConfigFileFolder");//注意这里写路径时要用c:\\而不是c:\
            openFileDialog1.Filter           = Tools.GetFileDialogFilter(data.Extensions);
            openFileDialog1.RestoreDirectory = true;
            openFileDialog1.FilterIndex      = 1;
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                string fileName = openFileDialog1.FileName;
                ActiveContent(data, fileName);
            }
        }
Ejemplo n.º 7
0
        private void loadMdxFileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog fileDialog = new OpenFileDialog();
            string         folder     = JSetting.ReadAppSetting("ConfigFileFolder");;

            fileDialog.InitialDirectory = folder;
            fileDialog.RestoreDirectory = true;

            fileDialog.Filter = "XML Files (.txt)|*.xml|All Files (*.*)|*.*";
            if (fileDialog.ShowDialog() == DialogResult.OK)
            {
                List <MdxCodeSnip> list = SerializeHelper.XmlDeserializeFromFile <List <MdxCodeSnip> >(fileDialog.FileName);
                if (list == null)
                {
                    return;
                }
                foreach (var item in list)
                {
                    AddMdxEditorTabPage(item.Name, item.ConnStr, item.Mdx);
                }
            }
        }
Ejemplo n.º 8
0
        private void btnBrowerFile_Click(object sender, EventArgs e)
        {
            OpenFileDialog fileDialog = new OpenFileDialog();
            string         folder     = JSetting.ReadAppSetting("ConfigFileFolder");

            if (!string.IsNullOrEmpty(txtFileName.Text))
            {
                var dic = new DirectoryInfo(Path.GetDirectoryName(txtFileName.Text));
                if (dic.Exists)
                {
                    folder = Path.GetDirectoryName(txtFileName.Text);
                }
            }

            fileDialog.InitialDirectory = folder;
            fileDialog.RestoreDirectory = true;

            fileDialog.Filter = "XML Files (.txt)|*.xml|All Files (*.*)|*.*";
            if (fileDialog.ShowDialog() == DialogResult.OK)
            {
                txtFileName.Text = fileDialog.FileName;
            }
        }
Ejemplo n.º 9
0
        private void txtSQLPreview_Load(object sender, EventArgs e)
        {
            txtSQLPreview.BoxPart.ReadOnly = false;
            #region tips

            btnIntelligentExecuteSQL.Tag = string.Format(@"{0}
{1}   
以上两行之内的SQL将一次性执行.
分段SQL开始符:{0}
分段SQL结束符:{1}
", Constants.SQLParagraphStartFlag, Constants.SQLParagraphEndFlag);
            this.ShowToolTips(new ToolTip());

            #endregion

            #region openFileDialog

            openFileDialog.InitialDirectory = JSetting.ReadAppSetting("OuputSQLFileFolder");

            StringBuilder filterBuilder = new StringBuilder();
            //FileInfoAttribute fia = FileType.SQL.GetFileInfoAttribute();
            //filterBuilder.AppendFormat(Constants.OpenFileDialogFilterFormart, fia.DefaultFileExtension, fia.DefaultDisplayName);
            //foreach (string fileExtension in fia.GetAllowFileExtensions(true))
            //{
            //    filterBuilder.AppendFormat(Constants.OpenFileDialogFilterFormart, fileExtension, fileExtension);
            //}
            filterBuilder.AppendFormat(Constants.OpenFileDialogFilterFormart, "sql", "sql文件");
            filterBuilder.AppendFormat(Constants.OpenFileDialogFilterFormart, "*", "所有");
            openFileDialog.Filter = filterBuilder.ToString().TrimEnd('|');

            openFileDialog.RestoreDirectory = true;
            openFileDialog.FilterIndex      = 1;

            #endregion
            txtSQLPreview.AllowDrop = true;
        }