Ejemplo n.º 1
0
        public int startPlugAndPlayApplication(WDSApplicationType appType, List<ADTRecord> adtRecList, ADCRRecord a_selectedADCRRecord)
        {
            ADTRecord[] adtRecs = new ADTRecord[adtRecList.Count];
            for (int i = 0; i < adtRecList.Count; i++)
                adtRecs[i] = adtRecList[i];

            if (!ADCRManager.instance().canAppAcceptSelDevs(appType, adtRecs))
            {
                GlobalServices.ErrMsg("WDSFrameWindow.startPlugAndPlayApplication()", "Application cannot accept selected devices!");
                return -1;
            }
            WDSApplication app = new WDSApplication(appType);
            IAppMainWindow mainWin = _lastCreatedMainWin = ADCRManager.instance().createAppMainWin(appType);
            if (mainWin == null)
            {
                GlobalServices.ErrMsg("startPlugAndPlayApplication()", "createAppMainWin() failed to create application's main window");
                return -1;
            }
            adtRecList[0].addAssociatedApp(a_selectedADCRRecord);
            _lastCreatedMainWin.associatedADCRRecord = a_selectedADCRRecord;
            IAppWindow[] helperWins = mainWin.createHelperWindows();
            if (helperWins != null)
                foreach (IAppWindow window2 in helperWins)
                    window2.createCloseWindowController();

            IIOPortHandler[] portHandlers = mainWin.createPortHandlers(adtRecs);
            mainWin.createCloseWindowController();
            app.setWindows(mainWin, helperWins);
            app.setPortHandlers(portHandlers);
            try
            {
                if (mainWin.initialize() == -1)
                {
                    GlobalServices.ErrMsg("startPlugAndPlayApplication()", "Application's main window initialization failed!");
                    return -1;
                }
                ((Form) mainWin).MdiParent = this;
                ((Form) mainWin).Show();
                if (helperWins != null)
                {
                    foreach (IAppWindow window3 in helperWins)
                    {
                        ((Form) window3).MdiParent = this;
                        ((Form) window3).Show();
                    }
                }
                WDSApplicationManager.instance().addApplication(app);
                return 0;
            }
            catch
            {
                return -1;
            }
        }
Ejemplo n.º 2
0
 public void removeAssociatedApp(ADCRRecord a_appDesc)
 {
     if (this.IsAssociatedApps(a_appDesc))
     {
         this._associatedApps.Remove(a_appDesc);
     }
 }
Ejemplo n.º 3
0
 public void addAssociatedApp(ADCRRecord a_appDesc)
 {
     if (!this._associatedApps.Contains(a_appDesc))
     {
         this._associatedApps.Add(a_appDesc);
     }
 }
Ejemplo n.º 4
0
 public bool IsAssociatedApps(ADCRRecord a_appDesc)
 {
     return this._associatedApps.Contains(a_appDesc);
 }
Ejemplo n.º 5
0
 public WDSApplicationType getApp(ADTRecord a_adt, List<GenListBoxItem<ADCRRecord>> a_appTypeList, out ADCRRecord a_record)
 {
     if (a_adt.DeviceInfo.EBID == null)
     {
         a_record = null;
         return WDSApplicationType.AppTypeMax;
     }
     foreach (GenListBoxItem<ADCRRecord> item in a_appTypeList)
     {
         foreach (CDTRecord record in item.ItemData.CompatibleChips.ChipList)
         {
             if ((record.ChipType == a_adt.DeviceInfo.EBID.ChipType) && (record.ChipRevision == a_adt.DeviceInfo.EBID.ChipRevision))
             {
                 a_record = item.ItemData;
                 return item.ItemData.ApplicationDescriptor.AppType;
             }
         }
     }
     a_record = null;
     return WDSApplicationType.AppTypeMax;
 }