public DeviceSettingsForm(GXDeviceManufacturerCollection manufacturers, GXDevice device)
 {
     Device = device;            
     Manufacturers = new GXDeviceManufacturerCollection();            
     InitializeComponent();
     AddManufacturers(manufacturers, Manufacturers);
     SettingsPanel.Dock = PropertyGrid.Dock = PresetList.Dock = CustomDeviceProfile.Dock = DockStyle.Fill;
     //Device type can not be changed after creation. This is for secure reasons.
     PresetCB.Enabled = CustomRB.Enabled = PresetList.Enabled = CustomDeviceProfile.Enabled = Device == null;                  
     CustomDeviceProfile.Visible = false;            
     if (Device != null)
     {
         NameTB.Text = Device.Name;
         RefreshRateTp.Value = new DateTime(((long)Device.UpdateInterval) * 10000000 + RefreshRateTp.MinDate.Ticks);
         UpdateResendCnt(Device.ResendCount);
         UpdateWaitTime(Device.WaitTime);  
     }
     else
     {
         RefreshRateTp.Value = new DateTime(((long)1) * 10000000 + RefreshRateTp.MinDate.Ticks);                
     }
     //Add disabled actions.
     m_DisActions = new DisabledAction(Device == null ? DisabledActions.None : Device.DisabledActions);
     tabControl1.TabPages.Add(m_DisActions.DisabledActionsTB);
     this.Text = Gurux.DeviceSuite.Properties.Resources.DeviceSettingsTxt;
     this.GeneralTab.Text = Gurux.DeviceSuite.Properties.Resources.GeneralTxt;
     //Update helps from the resources.
     this.helpProvider1.SetHelpString(this.NameTB, Gurux.DeviceSuite.Properties.Resources.DeviceNameHelp);
     this.helpProvider1.SetHelpString(this.MediaCB, Gurux.DeviceSuite.Properties.Resources.MediaListHelp);
     this.helpProvider1.SetHelpString(this.RefreshRateTp, Gurux.DeviceSuite.Properties.Resources.RefreshRateHelp);
     this.helpProvider1.SetHelpString(this.OkBtn, Gurux.DeviceSuite.Properties.Resources.OKHelp);
     this.helpProvider1.SetHelpString(this.CancelBtn, Gurux.DeviceSuite.Properties.Resources.CancelHelp);
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="manufacturers"></param>
 public GXPresetDevicesForm(bool initializePreset, GXDeviceManufacturerCollection manufacturers, GXDeviceManufacturerCollection downloadable)
 {
     InitializeComponent();
     Bitmap bm = PublisherImage.BackgroundImage as Bitmap;
     bm.MakeTransparent();
     PublisherImage.BackgroundImage = bm;
     PresetPropertiesMenu.ShortcutKeys = Keys.Alt | Keys.Enter;
     PresetManufacturers = manufacturers;
     ManufacturersNode = PresetTree.Nodes.Add(Gurux.DeviceSuite.Properties.Resources.ManufacturersTxt);
     Downloadable = downloadable;
     InitializePreset = initializePreset;
 }
Example #3
0
        /// <summary>
		/// Initializes a new instance of the OpenDlg class.
		/// </summary>
        public OpenDlg(GXDeviceManufacturerCollection manufacturers, GXDeviceProfile target)
		{			
			InitializeComponent();
            Target = target;
            Manufacturers = manufacturers;            
			UpdateResources();
            if (GXDeviceList.GetDeviceTypes(false, null).Count == 0 && GXDeviceList.GetDeviceTypes(true, null).Count == 0)
            {
                throw new Exception(Gurux.DeviceSuite.Properties.Resources.NoDevicesPublishedTxt);
            }
            ShowPresetDevices();
			ShowCustomDeviceTypes();
		}
        public GXPublisherDlg(GXDeviceManufacturerCollection manufacturers)
        {
            Client = new JsonServiceClient(Gurux.DeviceSuite.Properties.Settings.Default.UpdateServer);
            Client.AlwaysSendBasicAuthHeader = true;
            Manufacturers = manufacturers;
            Target = manufacturers;
            InitializeComponent();
            Bitmap bm = PublisherImage.BackgroundImage as Bitmap;
            bm.MakeTransparent();
            PublisherImage.BackgroundImage = bm;

            Item = new GXPublisher();
            Pages.Add(new GXPublishStartPage());
            Pages.Add(new GXPublisherPage(this, Item));
            Pages.Add(new GXManufacturerPage(Item));
            Pages.Add(new GXModelPage(Item));
            Pages.Add(new GXVersionPage(Item));
            Pages.Add(new GXTemplatePage(Item));
            Pages.Add(new GXPublishing(this, Item));            
            Pages.Add(new GXPublishFinishPage());
            ChangePage(0);
        }
        /// <summary>
		/// Initializes a new instance of the GXAmiImportForm class.
		/// </summary>
        public GXAmiImportForm(GXAmiClient client, GXDeviceManufacturerCollection manufacturers)
            : base(manufacturers, null)
		{
			InitializeComponent();
            Client = client;
		}
 public void Initialize()
 {
     GXDeviceManufacturerCollection manufacturers = Target as GXDeviceManufacturerCollection;
     if (manufacturers != null)
     {
         ManufacturerCB.Items.Clear();
         Manufacturers = manufacturers;
         foreach (GXDeviceManufacturer it in manufacturers)
         {
             ManufacturerCB.Items.Add(it);
         }
         if (manufacturers.Count != 0)
         {
             ManufacturerCB.SelectedIndex = 0;
         }
     }           
 }
 /// <summary>
 /// Only manufacturers in both device templates are shown.
 /// </summary>
 /// <param name="from"></param>
 /// <param name="to"></param>
 void AddManufacturers(GXDeviceManufacturerCollection from, GXDeviceManufacturerCollection to)
 {
     foreach (GXDeviceManufacturer man in from)
     {
         foreach (GXDeviceModel model in man.Models)
         {
             foreach (GXDeviceVersion version in model.Versions)
             {
                 if (version.Templates.Count != 0)
                 {
                     to.Add(man);
                 }
             }
         }
     }
 }
Example #8
0
        private void Form1_Load(object sender, EventArgs e)
        {
            try
            {
                //Update previous installed settings.
                if (Properties.Settings.Default.UpdateSettings)
                {
                    Properties.Settings.Default.Upgrade();
                    Properties.Settings.Default.UpdateSettings = false;
                    Properties.Settings.Default.Save();
                }

                Published = new GXDeviceManufacturerCollection();
                GXDeviceManufacturerCollection.Load(Published, GXDeviceManufacturerCollection.PublishedPath);                
                WorkArea.Controls.Add(Editor.EditorPanel);
                Editor.EditorPanel.Visible = false;
                WorkArea.Controls.Add(Director.DirectorPanel);
                Director.DirectorPanel.Visible = false;
                WorkArea.Controls.Add(AMI.AmiPanel);
                AMI.AmiPanel.Visible = false;
                if (!string.IsNullOrEmpty(Gurux.DeviceSuite.Properties.Settings.Default.Bounds))
                {
                    try
                    {
                        System.Drawing.Rectangle rc = (System.Drawing.Rectangle)new System.Drawing.RectangleConverter().ConvertFromString(Gurux.DeviceSuite.Properties.Settings.Default.Bounds);
                        if (rc.X > -1 && rc.Y > 0)
                        {
                            this.Bounds = rc;
                        }
                    }
                    catch (Exception ex)
                    {
                        System.Diagnostics.Debug.WriteLine(ex.Message);
                    }
                }

                if (Gurux.DeviceSuite.Properties.Settings.Default.MruFiles != null)
                {
                    foreach(string it in Gurux.DeviceSuite.Properties.Settings.Default.MruFiles)
                    {
                        MruManager.Insert(-1, it);
                    }
                }
                m_ShowMediaTrace = ShowMediaTrace.Checked = Gurux.DeviceSuite.Properties.Settings.Default.ShowMediaTrace;
                Editor.Visible = true;
                Editor.Visible = false;
                Director.Visible = true;
                Director.Visible = false;
                AMI.Visible = true;
                AMI.Visible = false;
                LoadUISettings();
                NewDeviceListMenu_Click(null, null);
                //AMI trace level is updated when user selects new DC or device.
                if (SelectedApplication != AppType.Ami)
                {
                    UpdateTraceLevel((System.Diagnostics.TraceLevel)Gurux.DeviceSuite.Properties.Settings.Default.TraceLevel);
                }
                else//Disable trace.
                {
                    TraceMenu.Enabled = false;
                }
                Director.OnDirty += new DirtyEventHandler(this.OnDirty);
                Editor.OnDirty += new DirtyEventHandler(this.OnDirty);                                
                //Do not check updates while debugging.
                if (!System.Diagnostics.Debugger.IsAttached)
                {
                    //Check protocol and application updates.                
                    Gurux.Common.CheckUpdatesEventHandler p = (Gurux.Common.CheckUpdatesEventHandler)this.OnCheckUpdatesEnabled;
                    ThreadPool.QueueUserWorkItem(Gurux.Common.GXUpdateChecker.CheckUpdates, p);
                }                
                GXDeviceManufacturerCollection.Load(Editor.Manufacturers);
                PublishMenu.Enabled = Editor.Manufacturers.IsPresetDevices();
                Director.Manufacturers = Editor.Manufacturers;
                //Check new preset device templates from Gurux.
                ThreadPool.QueueUserWorkItem(new WaitCallback(CheckUpdates), this);
                //If AMI is enabled.
                if (Gurux.DeviceSuite.Properties.Settings.Default.AmiEnabled)
                {
                    try
                    {
                        AMI.Start(false, false);
                    }
                    catch (Exception ex)
                    {
                        GXCommon.ShowError(this, ex);
                    }
                }

            }
            catch (Exception ex)
            {
                GXCommon.ShowError(this, ex);
            }
        }
        private void AddDevicePagesContent(GXDeviceManufacturerCollection manufacturers, GXDevice device, List<Control> pages)
		{
            //If new device is created.
            //If device is modified this is skipped.
            if (DeviceSettings == null)
            {
                pages.Add(new GXWizardStartPage());
                DeviceSettings = new GXWizardDeviceSettings();
                pages.Add(DeviceSettings);
            }            
            pages.Add(new GXWizardProtocolSettings());
            pages.Add(new GXWizardFinishPage());
		}