/// <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; } }
/// <summary> /// Constructor. /// </summary> /// <param name="addIn"></param> public GXImportStartForm(GXProtocolAddIn addIn) { InitializeComponent(); DeviceRB.Text = Gurux.DeviceSuite.Properties.Resources.FromDeviceTxt; CustomProtocolRB.Checked = CustomProtocolRB.Enabled = addIn.ImportFromFileEnabled; DeviceRB.Enabled = DeviceRB.Checked = addIn.ImportFromDeviceEnabled; CustomProtocolRB.Text = addIn.Name + " File"; //This page is shown only if both import from device and file are enabled. IsShown = addIn.ImportFromDeviceEnabled && addIn.ImportFromFileEnabled; }
public GXWizardPropertySettingsPage(GXProtocolAddIn addIn, object parent) { InitializeComponent(); TargetParent = parent; AddIn = addIn; this.TopLevel = false; this.FormBorderStyle = FormBorderStyle.None; TypeDdl.DrawMode = DrawMode.OwnerDrawFixed; TypeDdl.DrawItem += new DrawItemEventHandler(TypeDdl_DrawItem); UpdateResources(); }
/// <summary> /// Initializes a new instance of the GXWizardDlg class. /// </summary> /// <param name="target">The type of the target is either GXDevice, GXCategory, GXTable or GXProperty.</param> public GXWizardDlg(object target, object parent, GXProtocolAddIn addIn) { try { AddIn = addIn; TargetParent = parent; Target = target; InitializeComponent(); UpdateResources(); UpdatePages(AddIn, TargetParent); ChangePage(0); HidePageCB.Checked = !Gurux.DeviceSuite.Properties.Settings.Default.ShowWizardStartPage; this.Text = Gurux.DeviceSuite.Properties.Resources.DeviceProfileWizardTitle; } catch (Exception ex) { GXCommon.ShowError(this, ex); } }
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."); } } }
private void AddSettingsPage(GXProtocolAddIn addIn, object parent, List<Control> pages) { pages.Add(new GXWizardPropertySettingsPage(addIn, parent)); }
internal static void GetAddInInfo(GXProtocolAddIn addIn, out Type deviceType, System.Collections.Generic.List<Type> types) { deviceType = addIn.GetDeviceType(); types.Add(typeof(Gurux.Communication.ChecksumType)); types.Add(typeof(PartialReadType)); types.Add(typeof(PartialReadType)); types.Add(deviceType); Type[] tmp = addIn.GetCategoryTypes(null); if (tmp != null && tmp.Length != 0) { types.AddRange(tmp); } tmp = addIn.GetTableTypes(null); if (tmp != null && tmp.Length != 0) { types.AddRange(tmp); } tmp = addIn.GetPropertyTypes(null); if (tmp != null && tmp.Length != 0) { types.AddRange(tmp); } tmp = addIn.GetExtraTypes(null); if (tmp != null && tmp.Length != 0) { types.AddRange(tmp); } }
/// <summary> /// Creates a new instance of GXDevice using the specfied GXProtocolAddIn. /// </summary> public static GXDevice CreateDeviceProfile(GXProtocolAddIn addIn, string profile) { if (addIn == null) { throw new Exception(Resources.NoProtocolsFound); } GXDevice device = Activator.CreateInstance(addIn.GetDeviceType()) as GXDevice; device.ProfileGuid = device.Guid = Guid.NewGuid(); device.m_AddIn = addIn; device.ProtocolName = addIn.Name; device.ProtocolFile = Path.GetFileName(addIn.GetType().Assembly.Location); device.ProfileName = profile; return device; }