Пример #1
0
        private void RefreshServerService(string serverHostName)
        {
            if (serverHostName.EqualsIgnoreCase(Environment.MachineName))
            {
                // A remote monitor service will never be running on the same machine as this form.
                return;
            }

            try
            {
                using (var stfMonitorSvcCxn = STFMonitorServiceConnection.Create($"{serverHostName}.{GlobalSettings.Items[Setting.DnsDomain]}"))
                {
                    stfMonitorSvcCxn.Channel.RefreshConfig();
                }
            }
            catch (CommunicationException ex)
            {
                TraceFactory.Logger.Debug(ex.ToString());
                MessageBox.Show($"Failed to refresh service config on {serverHostName}.{Environment.NewLine}Manually refresh the STFMonitor service for changes to take effect.", "Refresh Server Service", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Пример #2
0
        private void ValidateServiceOutputPath(ref CancelEventArgs e)
        {
            string message = string.Empty;
            bool   result  = false;

            try
            {
                using (var stfMonitorSvcCxn = STFMonitorServiceConnection.Create($"{_serverHostName}.{GlobalSettings.Items[Setting.DnsDomain]}"))
                {
                    result = stfMonitorSvcCxn.Channel.IsValidDirectoryPath(destination_TextBox.Text);
                    if (!result)
                    {
                        message = "Invalid file path";
                    }
                }
            }
            catch (CommunicationException ex)
            {
                message = ex.Message;
            }

            _errorProvider.SetError(label_Destination, message);
            e.Cancel = !result;
        }