private void btnGracefulShutdown_Click(object sender, EventArgs e)
        {
            try
            {
                WeiMonitoringClient client = new WeiMonitoringClient();
                client.ShutdownGracefully();

                // Use the 'client' variable to call operations on the service.

                // Always close the client.
                client.Close();
            }
            catch (CommunicationException ex)
            {
                frmInterfaceGrid.Rows.Clear();
                //MessageBox.Show("Service is not running now!");
                StatusLabel.Text = "Service is not running.";
            }
        }
示例#2
0
        private void btnForceShutdown_Click(object sender, EventArgs e)
        {
            try
            {
                ServiceController service = new ServiceController(serviceName);
                switch (service.Status)
                {
                case ServiceControllerStatus.Running:
                    string       message = null;
                    DialogResult dresult;
                    message = "Do you want to forcefully shutdown the service?. Any messages in the queues that are currently being processed may be lost.";
                    dresult = MessageBox.Show(message, "Warning!", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);

                    if (dresult == DialogResult.OK)
                    {
                        WeiMonitoringClient client = new WeiMonitoringClient();
                        if (client != null)
                        {
                            client.forceShutdown();

                            // Use the 'client' variable to call operations on the service.

                            // Always close the client.
                            client.Close();
                            StatusLabel.Text = "WEI Service was forecefully shutdown.";
                        }
                    }
                    break;

                default:
                    StatusLabel.Text = "WEI Service stopped.";
                    break;
                }
            }
            catch (Exception ex)
            {
                frmInterfaceGrid.Rows.Clear();
                //MessageBox.Show("Service is not running now!");
                StatusLabel.Text = "WEI Service is not currently running";
                //LogUtil.log("", ex.InnerException);
            }
        }
        private void frmInterfaceGrid_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (frmInterfaceGrid.RowCount > 0)
            {
                if (e.ColumnIndex == 3)
                {
                    string message = "Unable to get message statistics";
                    object value   = frmInterfaceGrid.Rows[e.RowIndex].Cells[0].Value;

                    WeiMonitoringClient client = new WeiMonitoringClient();
                    message = client.getStatistics(int.Parse(value.ToString()));

                    // Use the 'client' variable to call operations on the service.

                    // Always close the client.
                    client.Close();
                    MessageBox.Show(message);
                    //StatusLabel.Text = message;
                }
            }
        }
示例#4
0
        private void frmInterfaceGrid_CellContentClick_1(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (frmInterfaceGrid.RowCount > 0)
                {
                    if (e.ColumnIndex == 3)
                    {
                        string message = "Unable to get message statistics";
                        object value   = frmInterfaceGrid.Rows[e.RowIndex].Cells[0].Value;

                        WeiMonitoringClient client = new WeiMonitoringClient();
                        if (client != null)
                        {
                            message = client.getStatistics(int.Parse(value.ToString()));
                            // Use the 'client' variable to call operations on the service.

                            // Always close the client.
                            client.Close();
                            MessageBox.Show(message);
                        }
                    }
                    if (e.ColumnIndex == 4)
                    {
                        //Application.Run(new ShowRequestsWithErrors());
                        //ShowRequestsWithErrors.ActiveForm.ShowDialog();
                        int _interfaceID;
                        _interfaceID = Int32.Parse(frmInterfaceGrid.Rows[e.RowIndex].Cells[0].Value.ToString());
                        ShowRequestsWithErrors newForm = new ShowRequestsWithErrors(_interfaceID);
                        newForm.ShowDialog();
                    }
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
            }
        }