Example #1
0
 public static void Copy(String path)
 {
     RAPI r=new RAPI();
     try
     {
         if (r.DevicePresent)
         {
             r.Connect();
             Consoler("Copying database to PDA. Wait...");
             r.CopyFileToDevice(path, path2device, true);
             FileDeleter(pathbase);
         }
         else
         {
             Consoler("No Device Connected");
             Log("No Device Connected",logpath);
         }
     }
     catch(Exception e)
     {
         if (e.Message == "Could not create remote file ")
             path2device = "\\Sd Card\\BelmostPDA.sdf";
         try
         {
             Consoler("Copying database to PDA. Wait...");
             r.CopyFileToDevice(path,path2device,true);
             FileDeleter(pathbase);
         }
         catch (Exception ex)
         {
             Consoler(ex.Message);
             Log(ex.Message,logpath);
         }
     }
 }
Example #2
0
        public override void Run()
        {
            /// алгоритм
            /// Disconnect от КПК базы
            /// на основании ConnectionSettings скопировать
            /// базу с винчейстера на КПК
            /// event в самом конце (Max = 1 Pos = 1)
            /// Running не обрабатывается
            ///

            /// Дополнение:  если ToPDA == true то копирование идет не на КПК а из КПК
            DataBasePDA.Disconnect();
            RAPI rapi=new RAPI();
            if(!ToPDA)
               try
                    {
                        if(rapi.DevicePresent)
                        rapi.Connect();
                        rapi.CopyFileToDevice(ConnectionSettings.GetSettings().PDAConnectionString,
                                              ConnectionSettings.GetSettings().PDAConString, true);
                        Loging.Loging.WriteLog("Coping to PDA complete", false, true);
                        File.Delete(ConnectionSettings.GetSettings().PDAConnectionString);

                    }
                    catch (Exception e)
                    {
                        Loging.Loging.WriteLog("Coping  to PDA failed: " + e.Message, false, true);
                    }

            else
                try
                {
                    if(rapi.DevicePresent)
                    rapi.Connect();
                    rapi.CopyFileFromDevice(ConnectionSettings.GetSettings().PDAConnectionString,
                                          ConnectionSettings.GetSettings().PDAConString, true);
                    Loging.Loging.WriteLog("Coping  from PDA complete", false, true);
                }
                catch (Exception e)
                {
                    if (e.Message == "Could not open remote file ")
                    {
                        if (ConnectionSettings.GetSettings().PDAConString == "\\Storage Card\\BelmostPDA.sdf")
                        {
                            ConnectionSettings.GetSettings().PDAConString = "\\Sd Card\\BelmostPDA.sdf";
                        }
                        else ConnectionSettings.GetSettings().PDAConString = "\\Storage Card\\BelmostPDA.sdf";
                        try
                        {
                             rapi.CopyFileFromDevice(ConnectionSettings.GetSettings().PDAConnectionString,
                                                ConnectionSettings.GetSettings().PDAConString, true);
                             Loging.Loging.WriteLog("Coping  from PDA complete", false, true);
                        }
                        catch(Exception ex)
                        {
                            Loging.Loging.WriteLog("Coping from PDA failed: " + ex.Message, false, true);
                            Coordinator.Canceled = true;
                        }
                    }
                    else
                    {
                        Loging.Loging.WriteLog("Coping from PDA failed: " + e.Message, false, true);
                        Coordinator.Canceled = true;
                    }
                }
            Coordinator.ExecuteDelegateArgs args = new Coordinator.ExecuteDelegateArgs();
            args.Maximum = 1;
            args.Pos = 1;
            args.runningAction = this;
            args.Name = Name();
            OnExecute(this, args);
        }