コード例 #1
0
 private void cb_Product_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cb_Product.SelectedText != "")
     {
         GlobalVar.gl_str_product = cb_Product.SelectedText;
         myFunction.WriteIniString(INIFileValue.gl_inisection_UpdateSql, INIFileValue.gl_iniKey_SqlName, GlobalVar.gl_str_product);//上传数据库名称
         myFunction myf = new myFunction();
         myf.ReadMapping();
     }
 }
コード例 #2
0
ファイル: IISUpdate.cs プロジェクト: trigrass2/ModBusControl
        /// <summary>
        /// 初始化
        /// </summary>
        private void InitIIS()
        {
            myFunction myfunction = new myFunction();

            this.Current_Ver = GetVerInt(myfunction.GetVersion());

            Thread m_CheckVer = new Thread(Thread_CheckVer);

            m_CheckVer.IsBackground = true;
            m_CheckVer.Name         = "检查服务器是否有新版本";
            m_CheckVer.Start();
        }
コード例 #3
0
        private void SystemForm_Load(object sender, EventArgs e)
        {
            myFunction myfunction = new myFunction();
            string     ver        = "当前版本:" + myfunction.GetVersion();

            if (GlobalVar.PCSoftware != null && GlobalVar.PCSoftware.NeedUpdate)
            {
                ver += "\r\n升级版本:" + GlobalVar.PCSoftware.Download_Ver;
            }

            this.label_Ver.Text = ver;
            byte[] plcver = GlobalVar.c_Modbus.HoldingRegisters.PLCVer.GetByte();
            this.label_PLCVer.Text = "PLC版本:" + Encoding.Default.GetString(ModbusTool.WordTwo(plcver, 0, plcver.Length)).Trim('\0');
        }
コード例 #4
0
ファイル: IISUpdate.cs プロジェクト: trigrass2/ModBusControl
        /// <summary>
        /// 备份文件(只保留近十个文件)
        /// </summary>
        /// <param name="FileName">需要备份的文件</param>
        private void BackupFiles(List <string> FileName)
        {
            if (!Directory.Exists(BackupFile))
            {
                Directory.CreateDirectory(BackupFile);
            }

            Dictionary <string, DateTime> File_CreateTime = new Dictionary <string, DateTime>();

            string[] dirs = Directory.GetDirectories(BackupFile);//获取子文件夹
            foreach (string dir in dirs)
            {
                File_CreateTime.Add(dir, File.GetCreationTime(dir));
            }
            var dicSort    = from objDic in File_CreateTime orderby objDic.Value descending select objDic;//Dictonary排序(降序) 如果需要升序  descending 去掉即可
            int FilesCount = 10;

            foreach (KeyValuePair <string, DateTime> kvp in dicSort)
            {
                if (--FilesCount < 0)
                {
                    Directory.Delete(kvp.Key, true);
                }
            }

            myFunction myfunction   = new myFunction();
            string     savepath     = myfunction.GetVersion();
            string     createfloder = CreateFolder(BackupFile + @"\", savepath);

            while (FileName.Count > 0)
            {
                try
                {
                    string file = FileName[0];
                    if (!File.Exists(file))
                    {
                        FileName.RemoveAt(0);
                        continue;
                    }
                    File.Copy(file, createfloder + @"\" + file);
                    FileName.RemoveAt(0);
                }
                catch (Exception ex)
                { }
            }
        }
コード例 #5
0
 private void btn_ReadUDisk_Click(object sender, EventArgs e)
 {
     try
     {
         myFunction myfunction = new myFunction();
         string[]   files      = new string[] {};
         string     err        = string.Empty;//异常信息
         if (!myfunction.Read_UDisk(ref files, ref err))
         {
             throw new Exception(err);
         }
         RefreshListView(files);
     }
     catch (Exception ex)
     {
         ErrMsgBox(ex.Message);
     }
 }
コード例 #6
0
        private void MarkChangeSetForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            MsgBox box = new MsgBox(MessageBoxButtons.YesNo);

            box.Title     = "保存";
            box.ShowText  = "打标器更换设定值是否保存";
            box.BackColor = Color.LimeGreen;
            if (box.ShowDialog() == DialogResult.OK)
            {
                INIFileValue.AlarmIntervalDay = Convert.ToInt16(this.textBox_AlarmTimeInterval.Text);
                INIFileValue.AlarmHour        = Convert.ToInt16(this.textBox_AlarmStartHour.Text);
                INIFileValue.AlarmMinute      = Convert.ToInt16(this.textBox_AlarmStartMinute.Text);
                INIFileValue.MarkTotalCount   = Convert.ToInt32(this.textBox_MarkTotalCount.Text);
                INIFileValue.MarkCount        = 0;//清零
                INIFileValue.MarkChangeTime   = DateTime.Now;

                myFunction myfunction = new myFunction();
                myfunction.SaveSheet();
            }
        }