예제 #1
0
 private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (myrapi.Connected)
     {
         myrapi.Disconnect();
     }
     myrapi.Dispose();
 }
예제 #2
0
 public void D_DisconnectDevice()
 {
     if (rapi.Connected)
     {
         rapi.Disconnect();
     }
 }
예제 #3
0
        public static void GetFileFormDevice(String SourcePath, String DestinationPath, bool Overwrite)
        {
            if (rapi.DevicePresent)
            {
                if (!rapi.Connected)
                {
                    rapi.Connect();
                }
                FileAttributes attr = File.GetAttributes(DestinationPath);
                if ((attr & FileAttributes.Directory).Equals(FileAttributes.Directory))   //DestinationPath is a directory
                {
                    DestinationPath = Path.Combine(DestinationPath, Path.GetFileName(SourcePath));
                }

                rapi.CopyFileFromDevice(DestinationPath, SourcePath, Overwrite);
                if (rapi != null && rapi.Connected)
                {
                    rapi.Disconnect();
                }
            }
        }
예제 #4
0
 private void buttonTest_Click(object sender, EventArgs e)
 {
     try
     {
         String progPath = Environment.CurrentDirectory + @"\test.txt";
         //String mobileDBPath = @"\Programme\test.txt";
         String mobileDBPath = @"Speicherkarte\test.txt";
         rapi.Connect();
         rapi.CopyFileToDevice(progPath, mobileDBPath, true);
         rapi.CopyFileFromDevice(progPath, mobileDBPath, true);
         rapi.Disconnect();
         MessageBox.Show("Rapi Connection Succesfull");
     }
     catch (Exception f)
     {
         MessageBox.Show(f.Message);
         MessageBox.Show(f.InnerException.ToString());
         MessageBox.Show("Rapi Connection Error");
     }
 }
예제 #5
0
        private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try {
                myRapi = new RAPI();
                bool HasDevice = true;
                if (!myRapi.DevicePresent)
                {
                    if (XtraMessageBox.Show("Please Connect Device. Or\n Load Previous File.(Y/N)", "Conformation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                    {
                        return;
                    }
                    HasDevice = false;
                }
                if (HasDevice)
                {
                    myRapi.Connect();
                    if (File.Exists(Application.StartupPath + "\\dbFile\\LocalDb.xml"))
                    {
                        if (myRapi.DeviceFileExists("\\Application\\MMPPL\\LocalDb.xml"))
                        {
                            File.Delete(Application.StartupPath + "\\dbFile\\LocalDb.xml");
                            myRapi.CopyFileFromDevice(Application.StartupPath + "\\dbFile\\LocalDb.xml", "\\Application\\MMPPL\\LocalDb.xml");
                            myRapi.DeleteDeviceFile("\\Application\\MMPPL\\LocalDb.xml");
                        }
                        else
                        {
                            MessageBox.Show("No Scan Data Found");
                            return;
                        }
                    }
                    else
                    {
                        if (myRapi.DeviceFileExists("\\Application\\MMPPL\\LocalDb.xml"))
                        {
                            myRapi.CopyFileFromDevice(Application.StartupPath + "\\dbFile\\LocalDb.xml", "\\Application\\MMPPL\\LocalDb.xml");
                            myRapi.DeleteDeviceFile("\\Application\\MMPPL\\LocalDb.xml");
                        }
                        else
                        {
                            MessageBox.Show("No Scan Data Found");
                            return;
                        }
                    }
                }
                if (File.Exists(Application.StartupPath + "\\dbFile\\LocalDb.xml"))
                {
                    bbiSave.PerformClick();
                    DataSet ds = new DataSet();
                    ds.ReadXml(Application.StartupPath + "\\dbFile\\LocalDb.xml");
                    string SRNO = "(";

                    foreach (DataRow dtr in ds.Tables["DeliveryChallan"].DefaultView.ToTable().Rows)
                    {
                        char[]   cr  = { '~' };
                        String[] str = dtr["BARCODE"].ToString().Split(cr);

                        SRNO = SRNO + "'" + str[1].ToString() + "',";
                    }
                    SRNO = SRNO.TrimEnd(',');
                    SRNO = SRNO + ")";

                    Dispatch.DispatchCall.UpdateLabelByDispatch(MMPPL.Dispatch.CurrObject.DptId, SRNO, Convert.ToDouble(txtLessWeight.Value));
                    tmrLine.Start();
                }
                else
                {
                    MessageBox.Show("No Scan Data Found");
                }
                if (HasDevice)
                {
                    myRapi.Disconnect();
                    myRapi.Dispose();
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message); }
        }
예제 #6
0
 private void ActiveSync_Disconnect()
 {
     m_RAPI.Disconnect();
 }