Exemplo n.º 1
0
 private int TsCustomApiProc(ref string pbstrBlob)
 {
     var iResult = 0;
     try
     {
         switch (CurrentBatch.BatchLocation)
         {
             case (int)ProcModule.QA:
             case (int)ProcModule.VR:
                 //  AutoIndex & Verification
                 var sControl = TsMemFiles.GetString("Lookup Command", "Control", "0", pbstrBlob);
                 var sFunction = TsMemFiles.GetString("Lookup Command", "Function", "0", pbstrBlob);
                 //if (Convert.ToInt32(sFunction) < 100)
                 //{
                 //    MessageBox.Show("Function: " + sFunction + "\r\n" + pbstrBlob);
                 //}
                 switch (sFunction)
                 {
                     case "1":
                         //Get Control Parameters
                         switch (sControl)
                         {
                             case "IndexPanel":
                                 //  Properties
                                 TsMemFiles.SetString("Control Properties", "Control", "IndexPanel", ref pbstrBlob);
                                 TsMemFiles.SetString("Control Properties", "Type", "1", ref pbstrBlob);
                                 TsMemFiles.SetString("Control Properties", "Storage", "1", ref pbstrBlob);
                                 TsMemFiles.SetString("Control Properties", "MinWidth", "400", ref pbstrBlob);
                                 TsMemFiles.SetString("Control Properties", "MinHeight", "400", ref pbstrBlob);
                                 iResult = 1;
                                 break;
                             default:
                                 iResult = 0;
                                 break;
                         }
                         break;
                     case "2":
                         //Create Control
                         switch (sControl)
                         {
                             case "IndexPanel":
                                 try
                                 {
                                     if (TsIndexPanel == null)
                                     {
                                         TsIndexPanel = new IndexPanel();
                                     }
                                     //  Set the call back property so we can do some cool stuff
                                     TsIndexPanel.TsCallBackHelper = TsCallbackHelper;
                                     TsIndexPanelHwnd = TsIndexPanel.Handle;
                                     TsMemFiles.SetString("Control Properties", "Control", "IndexPanel", ref pbstrBlob);
                                     TsMemFiles.SetString("Control Properties", "Handle", Convert.ToString(TsIndexPanelHwnd), ref pbstrBlob);
                                     iResult = 1;
                                     if (Support.Debug)
                                     {
                                         Support.WriteDebug("Custom Control in TSDataLookup DLL Created!");
                                     }
                                 }
                                 catch (Exception ex)
                                 {
                                     MessageBox.Show(ex.Message);
                                     iResult = -1;
                                 }
                                 break;
                             default:
                                 iResult = 0;
                                 break;
                         }
                         break;
                     case "3":
                         //Destroy Control
                         switch (sControl)
                         {
                             case "IndexPanel":
                                 try
                                 {
                                     if ((TsIndexPanel != null))
                                     {
                                         TsIndexPanel = null;
                                     }
                                     iResult = 1;
                                 }
                                 catch (Exception ex)
                                 {
                                     MessageBox.Show(ex.Message);
                                     iResult = -1;
                                 }
                                 if (Support.Debug)
                                 {
                                     Support.WriteDebug("Custom Control in TSDataLookup DLL Destroyed!");
                                 }
                                 break;
                             default:
                                 iResult = 0;
                                 break;
                         }
                         break;
                     case "4":
                         //Get Data From the Control
                         switch (sControl)
                         {
                             case "IndexPanel":
                                 iResult = 0;
                                 break;
                             default:
                                 iResult = 0;
                                 break;
                         }
                         break;
                     case "5":
                         //Send Data To the Control
                         switch (sControl)
                         {
                             case "IndexPanel":
                                 try
                                 {
                                     iResult = 0;
                                 }
                                 catch (Exception ex)
                                 {
                                     MessageBox.Show(ex.Message);
                                     iResult = -1;
                                 }
                                 break;
                             default:
                                 iResult = 0;
                                 break;
                         }
                         break;
                     case "6":
                         //Check if Data in the Control have changed
                         switch (sControl)
                         {
                             case "IndexPanel":
                                 try
                                 {
                                     iResult = 0;
                                 }
                                 catch (Exception ex)
                                 {
                                     MessageBox.Show(ex.Message);
                                     iResult = -1;
                                 }
                                 break;
                             default:
                                 iResult = 0;
                                 break;
                         }
                         break;
                     case "100":
                         //Set Focus To the Control
                         switch (sControl)
                         {
                             case "IndexPanel":
                                 try
                                 {
                                     if ((TsIndexPanel != null))
                                     {
                                         if ((TsIndexPanel.LastFocusControl != null))
                                         {
                                             TsIndexPanel.LastFocusControl.Focus();
                                         }
                                         TsIndexPanel.Refresh();
                                     }
                                     iResult = 1;
                                 }
                                 catch (Exception ex)
                                 {
                                     MessageBox.Show(ex.Message);
                                     iResult = -1;
                                 }
                                 break;
                             default:
                                 iResult = 0;
                                 break;
                         }
                         break;
                 }
                 break;
         }
     }
     catch (Exception)
     {
         throw;
     }
     return iResult;
 }
Exemplo n.º 2
0
 public TSDataLookupC()
 {
     Support.InitSettings();
     TsIndexPanel = new IndexPanel();
     _tsRepo = new TurboscanRepository(Support.CS2_Turboscan);
     _trackingRepo = new TrackingRepository(Support.CS1_Tracking);
 }