예제 #1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            Application.Current.Properties["CommandLine"] = e.Args;
            Utils.URLSecurityZoneAPI.InternetSetFeatureEnabled(Utils.URLSecurityZoneAPI.InternetFeaturelist.DISABLE_NAVIGATION_SOUNDS, Utils.URLSecurityZoneAPI.SetFeatureOn.PROCESS, true);
            Application.Current.DispatcherUnhandledException += new System.Windows.Threading.DispatcherUnhandledExceptionEventHandler(Current_DispatcherUnhandledException);
            var rapi = new OpenNETCF.Desktop.Communication.RAPI();
        }
예제 #2
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            Application.Current.Properties["CommandLine"] = e.Args;
            Utils.URLSecurityZoneAPI.InternetSetFeatureEnabled(Utils.URLSecurityZoneAPI.InternetFeaturelist.DISABLE_NAVIGATION_SOUNDS, Utils.URLSecurityZoneAPI.SetFeatureOn.PROCESS, true);
            Application.Current.DispatcherUnhandledException += new System.Windows.Threading.DispatcherUnhandledExceptionEventHandler(Current_DispatcherUnhandledException);
            var rapi = new OpenNETCF.Desktop.Communication.RAPI();
        }
예제 #3
0
파일: FrmMain.cs 프로젝트: darcyg/510-Null
        private void btnExportSetting_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("是否需要导出参数?", "询问", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
            {
                return;
            }
            try
            {
                string path = System.IO.Path.Combine(Application.StartupPath, "MySetting.xml");
                POS.Model.MySetting mysetting = new Model.MySetting();
                UserSetting         us        = (new SysParaSettingsBll(AppSettings.CurrentSetting.ParkConnect)).GetSetting <UserSetting>();
                if (us != null)
                {
                    SetValue(mysetting, us);
                }
                KeySetting ks = (new SysParaSettingsBll(AppSettings.CurrentSetting.ParkConnect)).GetSetting <KeySetting>();
                if (ks != null)
                {
                    SetValue(mysetting, ks);
                }
                TariffSetting ts = (new SysParaSettingsBll(AppSettings.CurrentSetting.ParkConnect)).GetSetting <TariffSetting>();
                if (ts != null)
                {
                    SetValue(mysetting, ts);
                }
                HolidaySetting hs = (new SysParaSettingsBll(AppSettings.CurrentSetting.ParkConnect)).GetSetting <HolidaySetting>();
                if (hs != null)
                {
                    SetValue(mysetting, hs);
                }
                List <OperatorInfo> opts = (new OperatorBll(AppSettings.CurrentSetting.ParkConnect)).GetAllOperators().QueryObjects;
                if (opts != null)
                {
                    SetValue(mysetting, opts);
                }

                XmlSerializer ser = new XmlSerializer(typeof(POS.Model.MySetting));
                using (FileStream stream = new FileStream(path, FileMode.Create, FileAccess.Write))
                {
                    ser.Serialize(stream, mysetting);
                }
                string remote = @"FlashDisk\RalidPos\MySetting.xml";
                OpenNETCF.Desktop.Communication.RAPI rapi = new OpenNETCF.Desktop.Communication.RAPI();
                if (rapi.DevicePresent)
                {
                    rapi.Connect();
                    rapi.CopyFileToDevice(path, remote, true);
                    rapi.Disconnect();
                }
                ShowMessage("导出参数成功,手持机上的收费软件需要重启后参数才会生效", Color.Black);
            }
            catch (Exception ex)
            {
                ShowMessage(ex.Message, Color.Red);
                Ralid.GeneralLibrary.ExceptionHandling.ExceptionPolicy.HandleException(ex);
            }
        }
예제 #4
0
 private void btnImportAuthen_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show(Resource1.FrmMain_ImportAuthenConfirm, Resource1.FrmMain_Query, MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
     {
         return;
     }
     try
     {
         string path   = System.IO.Path.Combine(Application.StartupPath, "AuthenRecord.txt");
         string remote = @"FlashDisk\RalidPos\AuthenRecord.txt";
         OpenNETCF.Desktop.Communication.RAPI rapi = new OpenNETCF.Desktop.Communication.RAPI();
         if (rapi.DevicePresent)
         {
             rapi.Connect();
             if (!rapi.Connected)
             {
                 ShowMessage(Resource1.FrmMain_ConnectHandsetFail, Color.Red);
                 return;
             }
             rapi.CopyFileFromDevice(path, remote, true);
             rapi.Disconnect();
             List <string> records = new List <string>();
             using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read))
             {
                 using (StreamReader reader = new StreamReader(fs))
                 {
                     while (!reader.EndOfStream)
                     {
                         string record = reader.ReadLine();
                         if (!string.IsNullOrEmpty(record))
                         {
                             records.Add(record);
                         }
                     }
                 }
             }
             if (records.Count > 0)
             {
                 SaveAuthensToPark(records);
             }
             else
             {
                 ShowMessage(Resource1.FrmMain_NoAuthenLog, Color.Black);
             }
         }
         else
         {
             ShowMessage(Resource1.FrmMain_FindnotHandet, Color.Red);
         }
     }
     catch (Exception ex)
     {
         ShowMessage(ex.Message, Color.Red);
         Ralid.GeneralLibrary.ExceptionHandling.ExceptionPolicy.HandleException(ex);
     }
 }
예제 #5
0
파일: FrmMain.cs 프로젝트: darcyg/510-Null
 private void btnCardEvent_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("是否需要导入收费记录?", "询问", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
     {
         return;
     }
     try
     {
         string path   = System.IO.Path.Combine(Application.StartupPath, "Record.txt");
         string remote = @"FlashDisk\RalidPos\Record.txt";
         OpenNETCF.Desktop.Communication.RAPI rapi = new OpenNETCF.Desktop.Communication.RAPI();
         if (rapi.DevicePresent)
         {
             rapi.Connect();
             rapi.CopyFileFromDevice(path, remote, true);
             rapi.Disconnect();
             List <string> records = new List <string>();
             using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read))
             {
                 using (StreamReader reader = new StreamReader(fs))
                 {
                     while (!reader.EndOfStream)
                     {
                         string record = reader.ReadLine();
                         if (!string.IsNullOrEmpty(record))
                         {
                             records.Add(record);
                         }
                     }
                 }
             }
             if (records.Count > 0)
             {
                 SavePaymentsToPark(records);
             }
         }
     }
     catch (Exception ex)
     {
         ShowMessage(ex.Message, Color.Red);
         Ralid.GeneralLibrary.ExceptionHandling.ExceptionPolicy.HandleException(ex);
     }
 }
예제 #6
0
        private void btnExportSetting_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show(Resource1.FrmMain_ExportConfig, Resource1.FrmMain_Query, MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
            {
                return;
            }
            try
            {
                string path = System.IO.Path.Combine(Application.StartupPath, "MySetting.xml");
                POS.Model.MySetting     mysetting = new Model.MySetting();
                FrmWorkstationSelection frm       = new FrmWorkstationSelection();
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    mysetting.StationID = frm.SelectedWorkstation;
                    UserSetting us = (new SysParaSettingsBll(AppSettings.CurrentSetting.ParkConnect)).GetSetting <UserSetting>();
                    if (us != null)
                    {
                        SetValue(mysetting, us);
                    }
                    KeySetting ks = (new SysParaSettingsBll(AppSettings.CurrentSetting.ParkConnect)).GetSetting <KeySetting>();
                    if (ks != null)
                    {
                        SetValue(mysetting, ks);
                    }
                    TariffSetting ts = (new SysParaSettingsBll(AppSettings.CurrentSetting.ParkConnect)).GetSetting <TariffSetting>();
                    if (ts != null)
                    {
                        SetValue(mysetting, ts);
                    }
                    HolidaySetting hs = (new SysParaSettingsBll(AppSettings.CurrentSetting.ParkConnect)).GetSetting <HolidaySetting>();
                    if (hs != null)
                    {
                        SetValue(mysetting, hs);
                    }
                    List <OperatorInfo> opts = (new OperatorBll(AppSettings.CurrentSetting.ParkConnect)).GetAllOperators().QueryObjects;
                    if (opts != null)
                    {
                        SetValue(mysetting, opts);
                    }

                    XmlSerializer ser = new XmlSerializer(typeof(POS.Model.MySetting));
                    using (FileStream stream = new FileStream(path, FileMode.Create, FileAccess.Write))
                    {
                        ser.Serialize(stream, mysetting);
                    }
                    string remote = @"FlashDisk\RalidPos\MySetting.xml";
                    OpenNETCF.Desktop.Communication.RAPI rapi = new OpenNETCF.Desktop.Communication.RAPI();
                    if (rapi.DevicePresent)
                    {
                        rapi.Connect();
                        if (!rapi.Connected)
                        {
                            ShowMessage(Resource1.FrmMain_ConnectHandsetFail, Color.Red);
                            return;
                        }

                        rapi.CopyFileToDevice(path, remote, true);
                        rapi.Disconnect();
                        ShowMessage(Resource1.FrmMain_ExportConfigSuccess, Color.Black);
                    }
                    else
                    {
                        ShowMessage(Resource1.FrmMain_FindnotHandet, Color.Red);
                    }
                }
            }
            catch (Exception ex)
            {
                ShowMessage(ex.Message, Color.Red);
                Ralid.GeneralLibrary.ExceptionHandling.ExceptionPolicy.HandleException(ex);
            }
        }