void UpdatePages(GXProtocolAddIn addIn, object parent) { if (Target == null || Target is GXDevice) { AddDevicePagesContent(parent as GXDeviceManufacturerCollection, Target as GXDevice, Pages); this.Text = Gurux.DeviceSuite.Properties.Resources.DeviceWizardTxt; } else if (Target is GXCategory) { ReadOnlyTarget = !string.IsNullOrEmpty(((GXCategory)Target).Name); AddSettingsPage(addIn, parent, Pages); addIn.ModifyWizardPages(Target, GXPropertyPageType.Category, Pages); this.Text = Gurux.DeviceSuite.Properties.Resources.CategoryWizardTxt; } else if (Target is GXTable) { ReadOnlyTarget = !string.IsNullOrEmpty(((GXTable)Target).Name); AddSettingsPage(addIn, parent, Pages); addIn.ModifyWizardPages(Target, GXPropertyPageType.Table, Pages); this.Text = Gurux.DeviceSuite.Properties.Resources.TableWizardTxt; } else if (Target is GXProperty) { ReadOnlyTarget = !string.IsNullOrEmpty(((GXProperty)Target).Name); AddSettingsPage(addIn, parent, Pages); addIn.ModifyWizardPages(Target, GXPropertyPageType.Property, Pages); this.Text = Gurux.DeviceSuite.Properties.Resources.PropertyWizardTxt; } foreach (Control it in Pages) { if (!(it is IGXWizardPage)) { throw new Exception(it.GetType().Name + " is not derived from IGXWizardPage."); } } }
/// <summary> /// Initializes a new instance of the ImportDlg class. /// </summary> /// <param name="gxAddIn">The currently used protocol addin.</param> /// <param name="gxDevice">The target device.</param> public GXImportDlg(System.Diagnostics.TraceLevel traceLevel, GXProtocolAddIn addIn, GXDevice device, bool fromDataCollector) { try { InitializeComponent(); Bitmap bm = Gurux.DeviceSuite.Properties.Resources.leaf; bm.MakeTransparent(); panel1.BackgroundImage = bm; TraceLevel = traceLevel; GXCommon.Owner = this; Start = new GXImportStartForm(addIn); Trace = new GXImportSearchForm(); Import = new GXImportPropertiesForm(); MediaSettings = new GXImportMediaForm(fromDataCollector); m_GXAddIn = addIn; m_GXDevice = device; UpdateResources(); //default settings m_ProtocolCustomPages.Add(Start); m_ProtocolCustomPages.Add(MediaSettings); m_ProtocolCustomPages.Add(Trace); m_ProtocolCustomPages.Add(Import); addIn.ModifyWizardPages(device, GXPropertyPageType.Import, m_ProtocolCustomPages); m_GXAddIn.OnProgress += new Gurux.Device.Editor.GXProtocolAddIn.ProgressEventHandler(OnProgress); m_GXAddIn.OnTrace += new Gurux.Device.Editor.GXProtocolAddIn.TraceEventHandler(OnTraceEvent); ChangePage(0); } catch (Exception Ex) { GXCommon.ShowError(this, Ex); this.DialogResult = DialogResult.None; } }