Ejemplo n.º 1
0
        public void dealMsg()
        {
            List <string> paperList1   = GetPaperType.GetPaperList("黑白");
            List <string> printerList1 = GetPrinterType.GetPrinterList("黑白");

            foreach (var v in main.groupList)
            {
            }
        }
Ejemplo n.º 2
0
 private void toolStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
 {
     if (tooldoWork != null)
     {
         if (HitFlag)
         {
             if (e.ClickedItem.Name.Substring(0, 2) == "刷新")
             {
                 ContextMenu contextMenu = new ContextMenu();
                 contextMenu.MenuItems.Add(0, new MenuItem("保存", subMenuItemClick));
                 int i = contextMenu.MenuItems.Add(1, new MenuItem("上次刷新" + ((int)((DateTime.Now - RefreshDateTime).TotalMinutes)).ToString() + "min"));
                 contextMenu.MenuItems[i].Enabled = false;
                 Point p = PointToClient(MousePosition);
                 contextMenu.Show(toolStrip1, p);
             }
             else if (e.ClickedItem.Name.Substring(0, 2) == "开始")
             {
                 ContextMenu contextMenu = new ContextMenu();
                 contextMenu.MenuItems.Add(0, new MenuItem("封面输出", subMenuItemClick));
                 contextMenu.MenuItems.Add(0, new MenuItem("合并输出", subMenuItemClick));
                 contextMenu.MenuItems.Add(0, new MenuItem("定时输出", subMenuItemClick));
                 contextMenu.MenuItems.Add(0, new MenuItem("多线输出", subMenuItemClick));
                 Point p = PointToClient(MousePosition);
                 contextMenu.Show(toolStrip1, p);
             }
             else if (e.ClickedItem.Name.Substring(0, 2) == "删除")
             {
                 ContextMenu contextMenu = new ContextMenu();
                 contextMenu.MenuItems.Add(0, new MenuItem("复制", subMenuItemClick));
                 contextMenu.MenuItems.Add(0, new MenuItem("合并", subMenuItemClick));
                 contextMenu.MenuItems.Add(0, new MenuItem("拆分", subMenuItemClick));
                 contextMenu.MenuItems.Add(0, new MenuItem("预览", subMenuItemClick));
                 contextMenu.MenuItems.Add(0, new MenuItem("中止", subMenuItemClick));
                 Point p = PointToClient(MousePosition);
                 contextMenu.Show(toolStrip1, p);
             }
         }
         else
         {
             if (e.ClickedItem.Name.Substring(0, 2) == "刷新")
             {
                 txt_user.Text   = "";
                 RefreshDateTime = DateTime.Now;
             }
             tooldoWork.Invoke(e.ClickedItem.Name.Substring(0, 2));
             if (e.ClickedItem.Name.Substring(0, 2) == "设置")
             {
                 系统设置 frm_sys = new 系统设置();
                 frm_sys.ShowDialog();
                 sysConfigData.printerName = ConfigClass.GetConfigString("sys", "小票打印机", "");
                 sysConfigData.ShopName    = ConfigClass.GetConfigString("sys", "店铺名称", "");
                 sysConfigData.BarcodePath = ConfigClass.GetConfigString("sys", "二维码路径", "");
                 FileHelper.timelist       = GetPeopleMsg.GetTimeList();
                 FileHelper.addrList       = GetPeopleMsg.GetAddrList();
                 FileHelper.rowMsg         = GetDefaultAddMsg.getMsg();
                 GetPaperType.UpdatePaperList();
                 GetPrinterType.UpdatePrinterList();
                 GetPaperPrice.getPrice();
             }
         }
     }
 }
Ejemplo n.º 3
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("数据库连接异常!");
            }
        }