public MainForm()
        {
            InitializeComponent();

            Size = FormSettings.FormSize;
            HorizontalSplitContainer.SplitterDistance = FormSettings.SplitterDistance;

            DashButtonListener.LoadButtons();
            DashButtonsBindingList      = new BindingList <DashButton>(DashButtonListener.DashButtons);
            DashButtonsTable.DataSource = new BindingSource(DashButtonsBindingList, null);

            DataGridViewButtonColumn testButtonColumn = new DataGridViewButtonColumn
            {
                Name       = "Test",
                HeaderText = "Test",
                Text       = "Test",
                UseColumnTextForButtonValue = true,
                AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells
            };

            DashButtonsTable.Columns.Add(testButtonColumn);

            DashButtonsTable.Columns["Enabled"].AutoSizeMode     = DataGridViewAutoSizeColumnMode.AllCells;
            DashButtonsTable.Columns["MacAddress"].AutoSizeMode  = DataGridViewAutoSizeColumnMode.DisplayedCells;
            DashButtonsTable.Columns["Description"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            DashButtonsTable.Columns["ActionUrl"].AutoSizeMode   = DataGridViewAutoSizeColumnMode.Fill;
        }
Example #2
0
 public DashButtonService()
 {
     InitializeComponent();
     DashButtonListener.OnNetworkListenerStarted += DashButtonListener_OnNetworkListenerStarted;
     DashButtonListener.OnDashButtonClicked      += DashButtonListener_OnDashButtonClicked;
     DashButtonListener.OnActionExceptionThrown  += DashButtonListener_OnActionExceptionThrown;
     DashButtonListener.OnExceptionThrown        += DashButtonListener_OnExceptionThrown;
     DashButtonListener.LoadButtons();
     FileSystemWatcher.Changed            += DashButtonFile_Changed;
     FileSystemWatcher.EnableRaisingEvents = true;
 }
Example #3
0
 private void DashButtonFile_Changed(object sender, FileSystemEventArgs e)
 {
     if (e.FullPath.Equals(DashButtonListener.DashButtonsFilePath))
     {
         try
         {
             DashButtonListener.LoadButtons();
             EventLog.WriteEntry("Reloaded dash buttons file.");
         }
         catch (IOException) { } // Ignore if the file is in use.
     }
 }