Exemple #1
0
        /// <summary>
        /// Handles the Click event of the BtnClose control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.RoutedEventArgs" /> instance containing the event data.</param>
        private void BtnClose_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            PortCommunication.ClosePort(serialPort);

            dynamic parentWindow = Window.GetWindow(this) as MainWindow;

            parentWindow.LoadIndex(sender, e);
        }
        /// <summary>
        /// Renders the result.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
        public void RenderResult(object sender, RoutedEventArgs e)
        {
            PortCommunication.ClosePort(serialPort);

            var dataContext = this.DataContext as MessuresViewModel;

            dynamic parentWindow = Window.GetWindow(this) as MainWindow;

            parentWindow.contentControl.Content = new Result(dataContext);
        }
        /// <summary>
        /// Handles the Click event of the btnTakeSample control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
        private void TakeSamples(object sender, RoutedEventArgs e)
        {
            if (serialPort == null)
            {
                throw new NullReferenceException(HaenggiModel.Presentation.Properties.Resources.DeviceNotFoundError);
            }

            if (serialPort.IsOpen)
            {
                PortCommunication.ClosePort(serialPort);
                ToogleButtons(true);
            }
            else
            {
                PortCommunication.OpenPort(serialPort);
                txt17.Focus();
                ToogleButtons(false);
            }
        }
 /// <summary>
 /// Removes the received value.
 /// </summary>
 public void HandleFormUnload()
 {
     PortCommunication.ClosePort(serialPort);
 }
 /// <summary>
 /// Closes the form.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
 private void CloseForm(object sender, EventArgs e)
 {
     PortCommunication.ClosePort(serialPort);
 }