Example #1
0
        /// <summary>
        /// Callback for menu item. Open report creating dialog.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CreateReport(object sender, EventArgs e)
        {
            // Called when the menu item is clicked
            ConfigDialog dialog = new ConfigDialog(m_host);

            dialog.ShowDialog();
        }
Example #2
0
        private void checkMailSettings()
        {
            string userName   = ConfigDialog.Instance.SMTPUserName;
            string smtpServer = ConfigDialog.Instance.SMTPServer;

            if (userName.Length == 0 || smtpServer.Length == 0)
            {
                uploadLog.Text          = "Unable to send mail, please enter your mail settings...\r\n";
                buttonCancel.Text       = "Close";
                buttonUpload.Enabled    = false;
                textDescription.Enabled = false;
                comboMaildrops.Enabled  = false;

                ConfigDialog config = ConfigDialog.Instance;
                if (!config.Visible && !settingsDialogShown)
                {
                    settingsDialogShown = true;
                    config.setMailTabActive();
                    config.ShowDialog();
                }
            }
            else
            {
                uploadLog.Text          = "";
                buttonCancel.Text       = "Cancel";
                textDescription.Enabled = true;
                comboMaildrops.Enabled  = true;
                buttonUpload.Enabled    = comboMaildrops.Text.Length > 0;
            }
        }
Example #3
0
 public void ShowConfigDialog()
 {
     if (_configDialog.ShowDialog(_form) == DialogResult.OK)
     {
         Config.Save();
         ApplyConfig();
         _mainBehavior.Notifier.StopRepeatingTimer(_configDialog.RepeatSettingsChanged);
     }
 }
Example #4
0
        public MainWindow()
        {
            InitializeComponent();
            if (null == Application.Current)
            {
                new System.Windows.Application();
            }
            mListBox.ItemsSource      = logs;
            mOpenMenuButton.Click    += mOpenMenuButton_Click;
            mSettingMenuButton.Click += mSettingMenuButton_Click;
            mApplication              = Application.Current;
            XDocument xml = XDocument.Load(Environment.CurrentDirectory + @"\configuration.xml");

            mPorts = (from Port in xml.Descendants("Port")
                      select new RTUSerialPort((from Slave in Port.Descendants("Slave")
                                                select new RTUSlave(byte.Parse(Slave.Attribute("SlaveId").Value), (from Parameter in Slave.Descendants("Parameter")
                                                                                                                   select new Parameter(Parameter.Attribute("Type").Value, ushort.Parse(Parameter.Attribute("Address").Value), Parameter.Attribute("Name").Value)).ToArray <Parameter>(), Slave.Attribute("SlaveName").Value)).ToArray <RTUSlave>(), Port.Attribute("PortName").Value, Port.Attribute("DisplayName").Value)).ToArray <RTUSerialPort>();
            Loaded += delegate
            {
                rowCount    = (int)Math.Floor(mVoltageGrid.ActualHeight / 320);
                columnCount = (int)Math.Floor(mVoltageGrid.ActualWidth / 320);
                PageCount   = 0;
                for (int i = 0; i < mPorts.Count(); i++)
                {
                    for (int j = 0; j < mPorts[i].mSlaves.Count(); j++)
                    {
                        PageCount++;
                    }
                }
                var x = PageCount / (rowCount * columnCount);
                var y = PageCount % (rowCount * columnCount);;
                PageCount = y > 0 ? x + 1 : x;
                for (int i = 0; i < rowCount; i++)
                {
                    mVoltageGrid.RowDefinitions.Add(new RowDefinition());
                }
                for (int i = 0; i < columnCount; i++)
                {
                    mVoltageGrid.ColumnDefinitions.Add(new ColumnDefinition());
                }
                JumpToPage(1);
                ConfigDialog dialog = new ConfigDialog(true);
                dialog.Owner = this;
                if (dialog.ShowDialog() == true)
                {
                    RtuHelper helper = new RtuHelper(mPorts, OnMessage, dialog.mBaudrate, dialog.mParity, dialog.mDataBits, dialog.mStopBit);
                }
                else
                {
                    RtuHelper helper = new RtuHelper(mPorts, OnMessage);
                }
            };
        }
Example #5
0
 private void OnConfigureClick(object sender, EventArgs e)
 {
     if (m_oDialog == null)
     {
         m_oDialog = new ConfigDialog();
     }
     if (m_oDialog.ShowDialog() != DialogResult.OK)
     {
         return;
     }
     m_bConfigurationChanged = true;
 }
Example #6
0
        public void ShowConfigDialog()
        {
            ConfigDialog dialog = new ConfigDialog();

            dialog.StartPosition = FormStartPosition.CenterParent;
            dialog.SetConfig(this);
            dialog.ShowDialog();
            if (dialog.Result == ConfigDialogResult.SaveReboot)
            {
                console.forceStopTimer();
                Program.Reboot = true;
                this.Close();
            }
        }
Example #7
0
        private static void OnOpenConfig(object parameter)
        {
            var dialog = new ConfigDialog();

            if (dialog.ShowDialog() != true)
            {
                return;
            }

            if (!MessageService.ShowYesNoQuestion(null, "To take the config changes in account you have to restart the application. Do you want to restart ?"))
            {
                return;
            }

            Process.Start(Application.ResourceAssembly.Location);
            Application.Current.Shutdown();
        }
Example #8
0
        private void ShowConfigDialog()
        {
            m_reset = new ManualResetEvent(false);
            Dispatcher.BeginInvoke((Action)(() =>
            {
                Hide();

                var dialog = new ConfigDialog();
                if (!Equals(dialog.ShowDialog(), true))
                {
                    Application.Current.Shutdown();
                }
                else
                {
                    Show();
                    m_reset.Set();
                }
            }));
            m_reset.WaitOne();
        }
Example #9
0
            public override bool OnCommand()
            {
                Log.Debug("Launching the configure tool");

                Config options = (Config)Plugin.Options;
                options.Save();

                ConfigDialog dlg = new ConfigDialog();
                dlg.propertyGrid1.SelectedObject = options;

                if(dlg.ShowDialog() == System.Windows.Forms.DialogResult.Cancel)
                {
                    Plugin.Options = Config.Load(options.mFileName);
                }
                else
                {
                    options.Save();
                }

                return true;
            }
Example #10
0
            public override bool OnCommand()
            {
                Log.Debug("Launching the configure tool");

                Options options = (Options)Plugin.Options;

                options.Save();

                ConfigDialog dlg = new ConfigDialog();

                dlg.propertyGrid1.SelectedObject = options;

                if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.Cancel)
                {
                    Plugin.Options = Options.Load(options.mFileName);
                }
                else
                {
                    options.Save();
                }

                return(true);
            }
 public bool ShowConfigDialog(ICodecConfig currentConfig)
 {
     ConfigDialog dialog = new ConfigDialog(currentConfig);
     dialog.ShowDialog();
     return dialog.Cancelled;
 }
Example #12
0
        void mSettingMenuButton_Click(object sender, RoutedEventArgs e)
        {
            ConfigDialog dialog = new ConfigDialog(false);

            dialog.ShowDialog();
        }
Example #13
0
        private void ServerConfigCommand_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            ConfigDialog cd = new ConfigDialog();

            cd.ShowDialog();
        }
Example #14
0
        public Main()
        {
            this.InitializeComponent();

            this._deviceConfigurationHelper = new DeviceConfigurationHelper();
            this._deviceConfiguration       = this._deviceConfigurationHelper.LoadConfig("default");

            using (var dialog = new ConfigDialog(_deviceConfiguration))
            {
                dialog.StartPosition = FormStartPosition.CenterParent;
                var dialogResult = dialog.ShowDialog(this);
                switch (dialogResult)
                {
                case DialogResult.OK:
                    this._deviceConfiguration = dialog.DeviceConfiguration;
                    this._deviceConfigurationHelper.SaveConfig("default", this._deviceConfiguration);
                    break;

                case DialogResult.Cancel:
                case DialogResult.None:
                    Task.Run(() => this.Invoke(o => o.Close()));
                    return;
                }
            }

            this.Text = $"Alturos PanTilt TestUI ({Application.ProductVersion})";
            this.SetConfigurationInfo();

            var startPtHeadCommunication = Task.Run(() => this.StartPanTiltCommunication());

            this.UpdateMousePanel();
            this.panelMouseControl.MouseWheel += MouseWheelZoom;

            //Disable TabPage Zoom - No ZoomProvider available
            //this.tabControl1.TabPages.Remove(this.tabPageCameraZoom);
            this._zoomProvider = new MockZoomProvider();
            this._zoomProvider.SetZoomAsync(0);
            this._zoomProvider.ZoomChanged += CameraControlZoomChanged;

            if (this._deviceConfiguration.CameraActive)
            {
                //Live Camera Image
                var url = $"http://{this._deviceConfiguration.CameraIpAddress}{this._deviceConfiguration.CameraJpegUrl}";

                IVideoSource source = new JPEGStream(url);
                ((JPEGStream)source).FrameInterval = 200;

                this._videoSourcePlayer             = new Accord.Controls.VideoSourcePlayer();
                this._videoSourcePlayer.VideoSource = source;
                this._videoSourcePlayer.Start();
                this._videoSourcePlayer.Dock = DockStyle.Fill;
                this.tabPageLiveView.Controls.Add(this._videoSourcePlayer);
            }
            else
            {
                //Visual Map
                this._cameraDrawEngine = new DrawEngine(4);
                this.UpdateCurrentImage();
                this.pictureBox_CameraPos.Visible = true;
            }

            startPtHeadCommunication.Wait();

            if (this._panTiltControl != null)
            {
                this.continiousMovementControl1.SetPanTiltControl(this._panTiltControl);
                this.fastMovementControl1.SetPanTiltControl(this._panTiltControl);
                this.absolutePositionControl1.SetPanTiltControl(this._panTiltControl);
                this._panTiltControl.PanTiltAbsolute(0, 0);
            }
        }
Example #15
0
        public Main()
        {
            Log.Debug("Start");

            this.InitializeComponent();

            this._deviceConfigurationHelper = new DeviceConfigurationHelper();
            this._deviceConfiguration       = this._deviceConfigurationHelper.LoadConfig("default");

            using (var dialog = new ConfigDialog(_deviceConfiguration))
            {
                dialog.StartPosition = FormStartPosition.CenterParent;
                var dialogResult = dialog.ShowDialog(this);
                switch (dialogResult)
                {
                case DialogResult.OK:
                    this._deviceConfiguration = dialog.DeviceConfiguration;
                    this._deviceConfigurationHelper.SaveConfig("default", this._deviceConfiguration);
                    break;

                case DialogResult.Cancel:
                case DialogResult.None:
                    Task.Run(() => this.Invoke(o => o.Close()));
                    return;
                }
            }

            this.Text = $"Alturos PanTilt TestUI - v{Application.ProductVersion}";
            this.labelPositionPan.Text  = "Pan: ?,??";
            this.labelPositionTilt.Text = "Tilt: ?,??";

            this.SetConfigurationInfo();

            var startPtHeadCommunication = Task.Run(() => this.StartPanTiltCommunication());

            this.UpdateMousePanel();

            if (this._deviceConfiguration.CameraActive)
            {
                //Live Camera Image
                var url = $"http://{this._deviceConfiguration.CameraIpAddress}{this._deviceConfiguration.CameraJpegUrl}";

                IVideoSource source = new JPEGStream(url);
                ((JPEGStream)source).FrameInterval = 200;

                this._videoSourcePlayer = new Accord.Controls.VideoSourcePlayer
                {
                    VideoSource = source,
                    Dock        = DockStyle.Fill
                };
                this._videoSourcePlayer.Start();
                this.tabPageLiveView.Controls.Add(this._videoSourcePlayer);
            }
            else
            {
                //Visual Map
                this._cameraDrawEngine = new DrawEngine(4);
                this.UpdateCurrentImage();
                this.pictureBox_CameraPos.Visible = true;
            }

            startPtHeadCommunication.Wait();

            if (this._panTiltControl != null)
            {
                this.continiousMovementControl1.SetPanTiltControl(this._panTiltControl);
                this.fastMovementControl1.SetPanTiltControl(this._panTiltControl);
                this.absolutePositionControl1.SetPanTiltControl(this._panTiltControl);
                this.eneoUserControl1.SetPanTiltControl(this._panTiltControl);
                this.alturosUserControl1.SetPanTiltControl(this._panTiltControl);
                this.movementFloodControl1.SetPanTiltControl(this._panTiltControl);
                this.commandSequenceControl1.SetPanTiltControl(this._panTiltControl);
                this.alturosUserControl1.SetDeviceConfiguration(this._deviceConfiguration);
                this.feedbackAnalyzeControl1.SetPanTiltControl(this._panTiltControl);
                this._panTiltControl.PanTiltAbsolute(0, 0);
            }
        }