private void OnClosed(object sender, FormClosedEventArgs e) { if (_controller != null) { _controller.Dispose(); _controller = null; } }
public void Setup(LocalSetupController controller, LocalSetupSettings settings) { string operation = null; try { operation = "IP Camera Emulator preparing"; controller.Log.Info("{0}...", operation); UpdateIpCamEmuConfiguration(controller.Model.IpCamEmu_Configuration, settings); } catch (Exception unhandledException) { controller.Log.Error(unhandledException); ShowError(operation, unhandledException); } try { operation = "IP Camera Emulator registering"; controller.Log.Info("{0}...", operation); RegisterIpCamera(settings); } catch (Exception unhandledException) { controller.Log.Error(unhandledException); ShowError(operation, unhandledException); } try { operation = "Prepare configuration folder"; controller.Log.Info("{0}...", operation); if (Directory.Exists(controller.Model.ConfigurationFolder)) { var files = Directory.GetFiles(controller.Model.ConfigurationFolder); foreach (var file in files) { File.Delete(file); } Directory.Delete(controller.Model.ConfigurationFolder); } Directory.CreateDirectory(controller.Model.ConfigurationFolder); } catch (Exception unhandledException) { controller.Log.Error(unhandledException); ShowError(operation, unhandledException); } try { operation = "Prepare client configuration: Report Tool"; controller.Log.Info("{0}...", operation); ReplaceAndSave(controller.Model.Client_ReportToolConfig, _reportToolConfigTemplate, settings); } catch (Exception unhandledException) { controller.Log.Error(unhandledException); ShowError(operation, unhandledException); } try { operation = "Prepare client configuration: Cam View Tool"; controller.Log.Info("{0}...", operation); ReplaceAndSave(controller.Model.Client_CamViewerToolConfig, _camViewToolConfigTemplate, settings); } catch (Exception unhandledException) { controller.Log.Error(unhandledException); ShowError(operation, unhandledException); } try { operation = "Prepare message router congiguration"; controller.Log.Info("{0}...", operation); ReplaceAndSave(controller.Model.MessageRouter_WpfServerConfig, _messageRouterConfigTemplate, settings); } catch (Exception unhandledException) { controller.Log.Error(unhandledException); ShowError(operation, unhandledException); } try { operation = "Prepare console image processing server congiguration"; controller.Log.Info("{0}...", operation); ReplaceAndSave(controller.Model.ImageProcessingServer_ServerCConfig, _ipsConfigTemplate, settings); } catch (Exception unhandledException) { controller.Log.Error(unhandledException); ShowError(operation, unhandledException); } MessageBox.Show("Configuration was created."); Application.OpenForms[0].DialogResult = DialogResult.OK; Application.OpenForms[0].Close(); }
private void OnLoad(object sender, EventArgs e) { _controller = new LocalSetupController(); _userPasswordLabel.Text = string.Format("Enter Windows password of {0}:", Environment.UserName); }