Esempio n. 1
0
        private void txt_path_DoubleClick(object sender, EventArgs e)
        {
            FolderBrowserDialog folder = new FolderBrowserDialog();

            if (folder.ShowDialog() == DialogResult.OK)
            {
                if (MessageBox.Show("修改路径将重启程序,请问是否继续?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
                {
                    CurrentPath = folder.SelectedPath;
                    //txt_path.Text = CurrentPath;
                    ConfigClass.SetConfigString("File", "path", CurrentPath);
                    Application.Restart();
                }
            }
        }
Esempio n. 2
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         ConfigClass.SetConfigString("sys", "小票打印机", comb_Printer.Text);
         ConfigClass.SetConfigString("sys", "店铺名称", txt_ShopName.Text);
         ConfigClass.SetConfigString("sys", "二维码路径", txt_Barcode.Text);
         ConfigClass.SetConfigString("sys", "二维码宽度", numericUpDown1.Value.ToString());
         ConfigClass.SetConfigString("sys", "log", cb_Log.Checked.ToString());
         ConfigClass.SetConfigString("sys", "Convert", cb_timerConvert.Checked.ToString());
         MessageBox.Show("保存成功!");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     //this.Close();
 }
Esempio n. 3
0
 private void CK_fastPrint_CheckedChanged(object sender, EventArgs e)
 {
     ConfigClass.SetConfigString("Printer", "speed", CK_fastPrint.Checked.ToString());
     nFastPrint = CK_fastPrint.Checked;
 }
Esempio n. 4
0
        private void Form1_Load(object sender, EventArgs e)
        {
            //File.AppendAllLines(@"E:\代码\C#\Winform\私单\打印管理20190916\20190820\打印管理\打印管理\bin\Debug\log\logtext 20190926 171728.txt",new string[] { "123456"});

            bool b = SQLiteHelper.SQLiteInit(string.Format(@"Data Source={0}\PrintDB.db", Application.StartupPath), "jtmes");

            if (b)
            {
                KeyPreview = true;
                try
                {
                    foreach (var v in toolStrip1.Items)
                    {
                        if (v is ToolStripButton)
                        {
                            ToolStripButton Tbtn = v as ToolStripButton;
                            if (Convert.ToString(Tbtn.Tag) == "1")
                            {
                                Tbtn.Paint     += toolStrip1_Paint;
                                Tbtn.MouseMove += toolStrip1_MouseMove;
                            }
                        }
                    }
                    logFlag = Convert.ToBoolean(ConfigClass.GetConfigString("sys", "log", "true"));
                    LogOperate.Init();
                    LogOperate.Start();
                    LogOperate.Add("软件运行");
                    CurrentPath = ConfigClass.GetConfigString("File", "path", "");
                    if (!Directory.Exists(CurrentPath))
                    {
                        FolderBrowserDialog f = new FolderBrowserDialog();
                        if (f.ShowDialog() == DialogResult.OK)
                        {
                            CurrentPath = f.SelectedPath;
                            ConfigClass.SetConfigString("File", "path", CurrentPath);
                        }
                        else
                        {
                            unInit = true;
                            Application.Exit();
                        }
                    }
                    string strFastPrint = ConfigClass.GetConfigString("Printer", "speed", "false");
                    CK_fastPrint.Checked = strFastPrint.ToUpper() == "TRUE" ? true : false;
                    nFastPrint           = CK_fastPrint.Checked;
                    bool bConvert = Convert.ToBoolean(ConfigClass.GetConfigString("sys", "Convert", "false"));
                    if (bConvert)
                    {
                        timer2.Interval = 1000;
                        timer2.Enabled  = true;
                    }
                    else
                    {
                        fileWatcher.Path = CurrentPath;
                        fileWatcher.EnableRaisingEvents = true;
                    }
                    sysConfigData.printerName = ConfigClass.GetConfigString("sys", "小票打印机", "");
                    sysConfigData.ShopName    = ConfigClass.GetConfigString("sys", "店铺名称", "");
                    sysConfigData.BarcodePath = ConfigClass.GetConfigString("sys", "二维码路径", "");
                    sound = new System.Media.SoundPlayer("Audio.wav");
                    sound.Load();
                    //main.groupList = ConfigClass.LoadCookie<GroupMsg>("cookie.dat");
                    main.groupList = SqlModlus.selectTmpUserMsg();
                    if (main.groupList == null)
                    {
                        main.groupList = new List <GroupMsg>();
                    }
                    foreach (var v in main.groupList)
                    {
                        if (!v.isManual)
                        {
                            List <FileMsg> fmsg = SqlModlus.selectTmpFileMsg(v.UserID);
                            v.FileMsgList = fmsg;
                        }
                    }
                    main.groupList.ForEach(t => t.isPrint = false);
                    main.groupList.RemoveAll(t => t.isRemove == true);
                    txt_Date.Text = DateTime.Now.Date.ToLongDateString();
                    CurrentDate   = txt_Date.Text;

                    FileHelper.timelist = GetPeopleMsg.GetTimeList();
                    FileHelper.addrList = GetPeopleMsg.GetAddrList();
                    FileHelper.rowMsg   = GetDefaultAddMsg.getMsg();
                    GetPaperType.UpdatePaperList();
                    GetPrinterType.UpdatePrinterList();
                    GetPaperPrice.getPrice();

                    GetUserMsg(CurrentPath);
                    WordToPdf.Start();
                    DealControl(new int[] { 0, 0, 0 });
                    CheckForIllegalCrossThreadCalls = false;
                    treeView1.ExpandAll();
                    treeView1.MouseDoubleClick += new MouseEventHandler(treeView1_DoubleClick);
                    txt_path.Text = CurrentPath;
                    //FileHelper.act.BeginInvoke(frm_Main.CurrentPath, callback, null);
                    frm_MainMenu = New_Form(frm_MainMenu);
                    tooldoWork   = frm_MainMenu.doWork;
                    if (frm_MainMenu != null)
                    {
                        frm_MainMenu.setdgvPos(panel_Parent.Width, panel_Parent.Height);
                    }
                    ExcelHelper.Start();
                    frm_MainMenu.refresh("");
                    toolStrip2.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.toolStrip2_ItemClicked);
                    unInit = false;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            else
            {
                MessageBox.Show("数据库连接异常!");
            }
        }