• 大小: 35KB
    文件类型: .cs
    金币: 1
    下载: 0 次
    发布日期: 2021-05-12
  • 语言: C#
  • 标签: 自动更新  

资源简介

根据服务器版本,自动更新PDA的程序,数据,脚本,更新方式有CAB、zip

资源截图

代码片段和文件信息

using System;
using System.Data;
using System.Text;
using System.Windows.Forms;
using Pda.Config;
using System.IO;
using System.Diagnostics;
using System.xml;
using System.Threading;
using System.Data.SQLite;


namespace Pda.Download
{
    public partial  class frmDownload : Form
    {
        private bool isEnd = false;
        Thread thUpdate = null;

        string UpdatePath = Path.Combine(PubUnit.rootPath PubUnit.patchPath);

        string xmlLocalPath = Path.Combine(PubUnit.rootPath PubUnit.xmlVerName);

        string xmlLocPath = Path.Combine(PubUnit.rootPath PubUnit.xmlLocalName);

        //string UpdatePath = Path.Combine(PubUnit.rootPath PubUnit.patchPath);

        private int FCount = 3;
        public frmDownload()
        {
            InitializeComponent();
            //全屏显示
            IntPtr hWnd = Win32.FindWindow(“HHTaskBar“ null);
            if (hWnd != IntPtr.Zero)
            {
                Win32.ShowWindow(hWnd 0);
            }
            timer1.Enabled = true;
            timer2.Enabled = true;
        }

        #region progress
        public delegate void dlgShowProcess(int pValue);
        public delegate void dlgShowMsg(string pMsg);
        private delegate void dlgDisableControl(System.Windows.Forms.Control pControl bool pFlag);

        public void ShowProcess(int pValue)
        {
            if (this.pbMsg.InvokeRequired)
            {
                dlgShowProcess dlg = new dlgShowProcess(ShowProcess);
                this.Invoke(dlg new object[] { pValue });
            }
            else
            {
                this.pbMsg.Value = pValue;
            }
        }
        public void ShowMsg(string pMsg)
        {
            if (this.label1.InvokeRequired)
            {
                dlgShowMsg dlg = new dlgShowMsg(ShowMsg);
                this.Invoke(dlg new object[] { pMsg });
            }
            else
            {
                this.label1.Text = pMsg;
            }
        }

        private void DisableControl(System.Windows.Forms.Control pControl bool pFlag)
        {
            if (pControl.InvokeRequired)
            {
                dlgDisableControl dlg = new dlgDisableControl(DisableControl);
                this.Invoke(dlg new object[] { pControl pFlag });
            }
            else
            {
                pControl.Enabled = pFlag;
            }
        }

        #endregion
        private void UPdate()
        {
        }
        private void ShowCount()
        {
            this.label1.Text = (string.Format(“{0}秒后自动开始下载。“ this.FCount));
        }
       
        private void timer1_Tick(object sender EventArgs e)
        {

            this.FCount--;
            this.ShowCount();
            if (this.FCount <= 0)
            {
                this.timer1.Enabled = (false);
                this.label1.Text = (string.Format(“正在更新中。。。“ this.FCoun

评论

共有 条评论