コード例 #1
0
        static void Main()
        {
            Process curProcess = Process.GetCurrentProcess();

            Process[] processes = Process.GetProcessesByName(curProcess.ProcessName);
            if (processes.Length > 1)
            {
                foreach (Process process in processes)
                {
                    if (curProcess.Id != process.Id)
                    {
                        if ((curProcess.MainModule.FileName == process.MainModule.FileName))
                        {
                            process.WaitForExit(2000);
                            if (!process.HasExited)
                            {
                                MessageBox.Show("检测到 Xindeco智能供应链系统(大通道机) 已运行!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                return;
                            }
                        }
                    }
                }
            }

            AppConfig.Load();

            if (AutoUpdate.Update(SoftwareType.BigChannelPM))
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new MainForm());
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: windygu/HaiLan
        static void Main()
        {
            Process curProcess = Process.GetCurrentProcess();

            Process[] processes = Process.GetProcessesByName(curProcess.ProcessName);
            if (processes.Length > 1)
            {
                foreach (Process process in processes)
                {
                    if (curProcess.Id != process.Id)
                    {
                        if ((curProcess.MainModule.FileName == process.MainModule.FileName)) //只检查进程在不同目录下的情况
                        {
                            process.WaitForExit(2000);                                       //等待上次的进程结束后再检查,否则重启终端时会有问题
                            if (!process.HasExited)
                            {
                                MessageBox.Show("检测到 通道机检货系统 已运行!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                return;
                            }
                        }
                    }
                }
            }
            //载入默认配置
            AppConfig.Load();

            if (AutoUpdate.Update(SoftwareType.自动下载_HLA))
            {
                SAPDataService.Init();
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new DownloadForm());
            }
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: windygu/MyHaiLan
        static void Main(string[] arg)
        {
            Process curProcess = Process.GetCurrentProcess();

            Process[] processes = Process.GetProcessesByName(curProcess.ProcessName);
            if (processes.Length > 1)
            {
                foreach (Process process in processes)
                {
                    if (curProcess.Id != process.Id)
                    {
                        if ((curProcess.MainModule.FileName == process.MainModule.FileName)) //只检查进程在不同目录下的情况
                        {
                            process.WaitForExit(2000);                                       //等待上次的进程结束后再检查,否则重启终端时会有问题
                            if (!process.HasExited)
                            {
                                MessageBox.Show("检测到 退货复核 已运行!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                return;
                            }
                        }
                    }
                }
            }

            AppConfig.Load();

#if DEBUG
            SysConfig.LGNUM    = "HL01";
            SysConfig.DeviceNO = "MYKKD-12";
            SysConfig.DBUrl    = @"Data Source=172.18.207.92;Initial Catalog=heilandb;User ID=sa;password=myk_123456";
#else
            if (arg.Length >= 3)
            {
                SysConfig.LGNUM    = arg[0];
                SysConfig.DeviceNO = arg[1];
                SysConfig.DBUrl    = arg[2];
            }
            else
            {
                SysConfig.DBUrl    = ConfigurationManager.ConnectionStrings["ConnStr"]?.ConnectionString;
                SysConfig.LGNUM    = ConfigurationManager.AppSettings["LGNUM"];
                SysConfig.DeviceNO = ConfigurationManager.AppSettings["DeviceNO"];

                if (string.IsNullOrEmpty(SysConfig.LGNUM) || string.IsNullOrEmpty(SysConfig.DeviceNO) || string.IsNullOrEmpty(SysConfig.DBUrl))
                {
                    MessageBox.Show("请从主界面运行程序", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
            }
#endif

            if (AutoUpdate.Update(SoftwareType.发货复核_单检机))
            {
                SAPDataService.Init();
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new LoginForm());
            }
        }
コード例 #4
0
        /// <summary>
        /// Performs an update of the data file with any licence keys
        /// available from the root solution folder.
        /// </summary>
        /// <returns></returns>
        private AutoUpdate.AutoUpdateStatus Update()
        {
            var licenceKeys = GetLicenceKeys();

            return(AutoUpdate.Update(
                       licenceKeys,
                       TestDataFile));
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: windygu/HaiLan
        static void Main(string[] arg)
        {
            LogHelper.WriteLine("程序开始运行...");
            Process[] processes  = Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName);
            Process   curProcess = Process.GetCurrentProcess();

            if (processes.Length > 1)
            {
                foreach (Process process in processes)
                {
                    if (curProcess.Id != process.Id)
                    {
                        if ((curProcess.MainModule.FileName == process.MainModule.FileName)) //只检查进程在不同目录下的情况
                        {
                            process.WaitForExit(2000);                                       //等待上次的进程结束后再检查,否则重启终端时会有问题
                            if (!process.HasExited)
                            {
                                MessageBox.Show("检测到 单检机发货 已运行!", "警告");
                                return;
                            }
                        }
                    }
                }
            }

            //载入默认配置
            AppConfig.Load();
            SysConfig.InitUomDic();

            if (arg.Length >= 3)
            {
                SysConfig.LGNUM    = arg[0];
                SysConfig.DeviceNO = arg[1];
                SysConfig.DBUrl    = arg[2];
            }
            else
            {
                MessageBox.Show("请从主界面运行程序", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            //检测版本
            if (AutoUpdate.Update(SoftwareType.单检机发货))
            {
                SAPDataService.Init();
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                try
                {
                    Application.Run(new LoginForm());
                }
                catch (Exception e)
                {
                    LogHelper.Error(e.Message, e.StackTrace);
                    MessageBox.Show("程序出现问题,请联系管理员!" + e.Message, "警告");
                }
            }
        }
コード例 #6
0
ファイル: Program.cs プロジェクト: windygu/HaiLan
        static void Main(String[] arg)
        {
            Process curProcess = Process.GetCurrentProcess();

            Process[] processes = Process.GetProcessesByName(curProcess.ProcessName);
            if (processes.Length > 1)
            {
                foreach (Process process in processes)
                {
                    if (curProcess.Id != process.Id)
                    {
                        if ((curProcess.MainModule.FileName == process.MainModule.FileName)) //只检查进程在不同目录下的情况
                        {
                            process.WaitForExit(2000);                                       //等待上次的进程结束后再检查,否则重启终端时会有问题
                            if (!process.HasExited)
                            {
                                MessageBox.Show("检测到 通道机主数据手工下载系统 已运行!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                return;
                            }
                        }
                    }
                }
            }

            AppConfig.Load();

            if (arg.Length >= 3)
            {
                SysConfig.LGNUM    = arg[0];
                SysConfig.DeviceNO = arg[1];
                SysConfig.DBUrl    = arg[2];
            }
            else
            {
                SysConfig.DBUrl = ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString;
                SysConfig.LGNUM = ConfigurationManager.AppSettings["LGNUM"];
            }

            if (AutoUpdate.Update(SoftwareType.通道机主数据手工下载系统))
            {
                //载入默认配置
                try
                {
                    SAPDataService.Init();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "警告");
                    return;
                }

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new MainForm());
            }
        }
コード例 #7
0
        static void Main(string[] arg)
        {
            Process curProcess = Process.GetCurrentProcess();

            Process[] processes = Process.GetProcessesByName(curProcess.ProcessName);
            if (processes.Length > 1)
            {
                foreach (Process process in processes)
                {
                    if (curProcess.Id != process.Id)
                    {
                        if ((curProcess.MainModule.FileName == process.MainModule.FileName)) //只检查进程在不同目录下的情况
                        {
                            process.WaitForExit(2000);                                       //等待上次的进程结束后再检查,否则重启终端时会有问题
                            if (!process.HasExited)
                            {
                                MessageBox.Show("检测到 箱复核 已运行!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                return;
                            }
                        }
                    }
                }
            }

            AppConfig.Load();

#if DEBUG
            SysConfig.LGNUM    = "HL01";
            SysConfig.DeviceNO = "GQ-4015";
            SysConfig.DBUrl    = @"Data Source=172.18.207.92;Initial Catalog=heilandb;User ID=sa;password=myk_123456";
#else
            if (arg.Length >= 3)
            {
                SysConfig.LGNUM    = arg[0];
                SysConfig.DeviceNO = arg[1];
                SysConfig.DBUrl    = arg[2];
            }
            else
            {
                MessageBox.Show("请从主界面运行程序", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
#endif

            SysConfig.loadReaderType();
            SysConfig.loadReaderTmPower();
            SysConfig.loadReaderTmIp();

            if (AutoUpdate.Update(SoftwareType.箱复核))
            {
                SAPDataService.Init();
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new LoginForm());
            }
        }
コード例 #8
0
        private async void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
        {
            var uri = new Uri("appupdatex://xx");

            // Launch the URI.
            var success = await Launcher.LaunchUriAsync(uri);

            if (!success)
            {
                txt.Text = "AppUpdate can not startup";
                Debug.WriteLine("AppUpdate can not startup");
                return;
            }
            ;

            await Task.Delay(1000);

            AutoUpdate.Update();
        }
コード例 #9
0
 public void BadClientLicenceKey()
 {
     AutoUpdate.Update("BAD CLIENT KEY", TestDataFile);
 }
コード例 #10
0
 public void BadServerLicenceKey()
 {
     AutoUpdate.Update("BADSERVERKEY", TestDataFile);
 }