Example #1
0
        /// <summary>
        /// Diagnostic the request.
        /// </summary>
        private void DiagnosticsRequest()
        {
            try
            {
                if (this.IsServiceRunning())
                {
                    var client = new CommServerClient();
                    client.DiagnosticsRequest(Settings.Default.ClientUri, Guid.NewGuid());
                    client.Close();
                }
                else
                {
                    this.SetIcon(RedIcon);
                }
            }
            catch (Exception exception)
            {
                this.mainWindowViewModel.ServerViewViewModel.Infos.Add(exception.Message);

                ////this.mainWindowViewModel.Host.UserInterface.DisplayMessage(exception.Message, Resources.ServiceCommunicationError, MessageButton.ButtonsOk, MessageType.MessageError);
                this.SetIcon(RedIcon);

                ////MessageBox.Show("Exception in client call: " + exception.Message);
            }
        }
        /// <summary>
        /// Starts the monitor.
        /// </summary>
        public void StartMonitor()
        {
            try
            {
                var client = new CommServerClient();

                ////var measurements = new ConfiguredMeasurements();

                ////for (int i = 0; i < 50; i++)
                ////{
                ////    var measurement = new ConfiguredMeasurement(true);
                ////    measurement.DeviceId = new ConfiguredMeasurementItem(true) { Value = "Some_Device_Id" + i.ToString(CultureInfo.InvariantCulture), MappingType = MappingTypes.StaticType };
                ////    measurement.SensorId = new ConfiguredMeasurementItem(true) { Value = "Some_Sensor_Id" + i.ToString(CultureInfo.InvariantCulture), MappingType = MappingTypes.StaticType };
                ////    measurement.Unit = new ConfiguredMeasurementItem(true) { Value = "m3", MappingType = MappingTypes.StaticType };
                ////    measurement.DataType = CommonFormatDataTypes.FloatType;
                ////    measurement.Timestamp = new ConfiguredMeasurementItem(true) { Value = "Some_Opc_ItemId", MappingType = MappingTypes.OpcTimestampType };
                ////    measurement.Quality = new ConfiguredMeasurementItem(true) { Value = "Some_Opc_ItemId", MappingType = MappingTypes.OpcQualityType };
                ////    measurement.Value = new ConfiguredMeasurementItem(true) { Value = "Some_Opc_ItemId", MappingType = MappingTypes.OpcValueType };
                ////    measurement.Active = true;
                ////    measurements.Add(measurement);
                ////}
                client.StartMonitorRequest(MainWindow.ClientUri, Guid.NewGuid(), this.mainWindowViewModel.Configuration.ConfiguredMeasurements);
                client.Close();

                this.measurementsMonitorStarted = true;
            }
            catch (Exception exception)
            {
                this.mainWindowViewModel.Host.UserInterface.DisplayMessage(exception.Message, Resources.Language_Selection, MessageButton.ButtonsOk, MessageType.MessageInformation, DefaultMessageButton.ButtonOk);
            }
        }
Example #3
0
 /// <summary>
 /// Called when [fis registration].
 /// </summary>
 private void OnFisRegistration()
 {
     try
     {
         var client = new CommServerClient();
         client.FisRegistrationRequest(MainWindow.ClientUri, Guid.NewGuid());
         client.Close();
     }
     catch (Exception exception)
     {
         this.mainWindowViewModel.Host.UserInterface.DisplayMessage(exception.Message, Resources.Language_Selection, MessageButton.ButtonsOk, MessageType.MessageInformation, DefaultMessageButton.ButtonOk);
     }
 }
 /// <summary>
 /// Buttons the test import configuration request.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
 private void ButtonTestImportConfigurationRequest(object sender, RoutedEventArgs e)
 {
     try
     {
         var client = new CommServerClient();
         client.ImportConfigurationRequest(ClientUri, Guid.NewGuid(), @"D:\1Data\public\Temp\ImsOpcBridgeConfiguration.xml");
         client.Close();
     }
     catch (Exception exception)
     {
         MessageBox.Show("Exception in client call: " + exception.Message);
     }
 }
 /// <summary>
 /// Buttons the test stop monitor request.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
 private void ButtonTestStopMonitorRequest(object sender, RoutedEventArgs e)
 {
     try
     {
         var client = new CommServerClient();
         client.StopMonitorRequest(ClientUri, Guid.NewGuid());
         client.Close();
     }
     catch (Exception exception)
     {
         MessageBox.Show("Exception in client call: " + exception.Message);
     }
 }
 /// <summary>
 /// Buttons the test read opc address space request.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
 private void ButtonTestReadOpcAddressSpaceRequest(object sender, RoutedEventArgs e)
 {
     try
     {
         var client = new CommServerClient();
         client.ReadOpcAddressSpaceRequest(ClientUri, Guid.NewGuid(), "Endress.OpcDa.Promag800.1");
         client.Close();
     }
     catch (Exception exception)
     {
         MessageBox.Show("Exception in client call: " + exception.Message);
     }
 }
        /// <summary>
        /// Buttons the test start monitor request.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
        private void ButtonTestStartMonitorRequest(object sender, RoutedEventArgs e)
        {
            try
            {
                var client       = new CommServerClient();
                var measurements = new ConfiguredMeasurements();

                for (int i = 0; i < 5; i++)
                {
                    Random rnd          = new Random();
                    var    randomNumber = rnd.Next(100);
                    var    measurement  = new ConfiguredMeasurement(true);
                    measurement.DeviceId = new ConfiguredMeasurementItem(true)
                    {
                        Value = "DeviceId_" + randomNumber.ToString(CultureInfo.InvariantCulture), MappingType = MappingTypes.StaticType
                    };
                    measurement.SensorId = new ConfiguredMeasurementItem(true)
                    {
                        Value = "SensorId_" + randomNumber.ToString(CultureInfo.InvariantCulture), MappingType = MappingTypes.StaticType
                    };
                    measurement.Unit = new ConfiguredMeasurementItem(true)
                    {
                        Value = "m3", MappingType = MappingTypes.StaticType
                    };
                    measurement.DataType  = CommonFormatDataTypes.FloatType;
                    measurement.Timestamp = new ConfiguredMeasurementItem(true)
                    {
                        Value = "Some_Opc_ItemId", MappingType = MappingTypes.OpcTimestampType
                    };
                    measurement.Quality = new ConfiguredMeasurementItem(true)
                    {
                        Value = "Some_Opc_ItemId", MappingType = MappingTypes.OpcQualityType
                    };
                    measurement.Value = new ConfiguredMeasurementItem(true)
                    {
                        Value = "Some_Opc_ItemId", MappingType = MappingTypes.OpcValueType
                    };
                    measurement.Active = true;
                    measurements.Add(measurement);
                }

                client.StartMonitorRequest(ClientUri, Guid.NewGuid(), measurements);
                client.Close();
            }
            catch (Exception exception)
            {
                MessageBox.Show("Exception in client call: " + exception.Message);
            }
        }
 /// <summary>
 /// Buttons the test save configuration request.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
 private void ButtonTestSaveConfigurationRequest(object sender, RoutedEventArgs e)
 {
     try
     {
         var client        = new CommServerClient();
         var configuration = new Configuration(true);
         configuration.Gateway.SerialNumber = "1234567890";
         client.SaveConfigurationRequest(ClientUri, Guid.NewGuid(), configuration);
         client.Close();
     }
     catch (Exception exception)
     {
         MessageBox.Show("Exception in client call: " + exception.Message);
     }
 }
        /// <summary>
        /// Stops the monitor.
        /// </summary>
        public void StopMonitor()
        {
            try
            {
                var client = new CommServerClient();
                client.StopMonitorRequest(MainWindow.ClientUri, Guid.NewGuid());
                client.Close();

                this.measurementsMonitorStarted = false;
            }
            catch (Exception exception)
            {
                this.mainWindowViewModel.Host.UserInterface.DisplayMessage(exception.Message, Resources.Language_Selection, MessageButton.ButtonsOk, MessageType.MessageInformation, DefaultMessageButton.ButtonOk);
            }
        }
Example #10
0
        /// <summary>
        /// Reads the opc address space.
        /// </summary>
        private void ReadOpcAddressSpace()
        {
            try
            {
                if (!string.IsNullOrEmpty(this.mainWindowViewModel.ConnectedServer.Name))
                {
                    this.mainWindowViewModel.ClearOpcItemMappingTreeOpcItems();

                    var client = new CommServerClient();
                    client.ReadOpcAddressSpaceRequest(MainWindow.ClientUri, Guid.NewGuid(), this.mainWindowViewModel.ConnectedServer.ClassId);
                    client.Close();
                }
            }
            catch (Exception exception)
            {
                this.mainWindowViewModel.Host.UserInterface.DisplayMessage(exception.Message, Resources.Language_Selection, MessageButton.ButtonsOk, MessageType.MessageInformation, DefaultMessageButton.ButtonOk);
            }
        }