Esempio n. 1
0
        private void App_OnStartup(object sender, StartupEventArgs e)
        {
            //Face.FaceFun.GetWhiteName(1);
            if (Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName).Length > 1)
            {
                IrAdvanced.WriteError("程序已经运行了一个实例,该程序只允许有一个实例");
                Current.Shutdown();
            }
            LoginWindowFactory.ConcreLoginWindow().Show();

            //Data.PoliceModel.SessionModel session = Data.CenterDataFactory.KeyTable();
            //Data.CenterDataFactory.WhiteName(session.Id, session.Name);

            //CustomControl.CustomWin.WinSetting win = new CustomControl.CustomWin.WinSetting();
            //win.Show();
        }
        /// <summary>窗体加载</summary>
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                VerText.Text = string.Format("版本号:{0}", Assembly.GetExecutingAssembly().GetName().Version);
                if (IrAdvanced.CheckRegisterState) //必须注册,否则IrControlLibrary中可能有部分方法无法使用
                {
                    WelcomeText.Text = "程序加载中...\n设备号:" + IrAdvanced.StrDeviceId;
                    TurnToMainWindows();

                    MessageBoxResult result = MessageBox.Show("是否同步比赛数据", "提示", MessageBoxButton.YesNo);
                    if (result == MessageBoxResult.Yes)
                    {
                        SubBaseForm sb = new SubBaseForm("正在同步比赛数据,请稍候...");
                        SubBaseForm.DelegateNonParmAndNonReturn my = new SubBaseForm.DelegateNonParmAndNonReturn(synchronizeData);
                        sb.NonParmAndNonReturnMethod(my);
                    }

                    result = MessageBox.Show("是否开启数据上传至公安服务", "提示", MessageBoxButton.YesNo);
                    if (result == MessageBoxResult.Yes)
                    {
                        bool is_AutoUpload = ConfigurationManager.AppSettings["Is_AutoUpload"].ToBool();
                        if (is_AutoUpload)
                        {
                            Thread thread = new Thread(Upload)
                            {
                                IsBackground = true
                            };
                            thread.Start();
                        }
                    }
                }
                else
                {
                    WelcomeText.Text = string.Format("程序未注册,请与供应商联系!\n设备号:{0}", IrAdvanced.StrDeviceId);
                }
            }
            catch (Exception ex)
            {
                IrAdvanced.WriteError("FrmMain.Window_Loaded:" + ex.Message);
            }
        }