/// <summary> /// Called before the form has loaded for the first time /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MainForm_Load(object sender, EventArgs e) { // Is the mouse enabled? if (!ApplicationSettings.Default.EnableMouse) { // Hide the cursor Cursor.Hide(); } // Move the cursor to the starting place if (!_screenSaver) { SetCursorStartPosition(); } // Show the splash screen ShowSplashScreen(); // Change the default Proxy class OptionForm.SetGlobalProxy(); // Set this form to topmost #if !DEBUG if (!_screenSaver) { TopMost = true; } #endif // UserApp data Debug.WriteLine(new LogMessage("MainForm_Load", "User AppData Path: " + ApplicationSettings.Default.LibraryPath), LogType.Info.ToString()); }
/// <summary> /// Called before the form has loaded for the first time /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MainForm_Load(object sender, EventArgs e) { // Check the directories exist if (!Directory.Exists(ApplicationSettings.Default.LibraryPath) || !Directory.Exists(ApplicationSettings.Default.LibraryPath + @"\backgrounds\")) { // Will handle the create of everything here Directory.CreateDirectory(ApplicationSettings.Default.LibraryPath + @"\backgrounds"); } // Is the mouse enabled? if (!ApplicationSettings.Default.EnableMouse) { // Hide the cursor Cursor.Hide(); } // Move the cursor to the starting place SetCursorStartPosition(); // Show the splash screen ShowSplashScreen(); // Change the default Proxy class OptionForm.SetGlobalProxy(); // UserApp data Debug.WriteLine(new LogMessage("MainForm_Load", "User AppData Path: " + ApplicationSettings.Default.LibraryPath), LogType.Info.ToString()); }
public OptionForm() { InitializeComponent(); Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath); Debug.WriteLine("Initialise Option Form Components", "OptionForm"); // Get a hardware key here, just in case we havent been able to get one before _hardwareKey = new HardwareKey(); // XMDS completed event xmds1.RegisterDisplayCompleted += new XiboClient.xmds.RegisterDisplayCompletedEventHandler(xmds1_RegisterDisplayCompleted); // Set global proxy information OptionForm.SetGlobalProxy(); // Settings Tab textBoxXmdsUri.Text = ApplicationSettings.Default.ServerUri; textBoxServerKey.Text = ApplicationSettings.Default.ServerKey; textBoxLibraryPath.Text = ApplicationSettings.Default.LibraryPath; tbHardwareKey.Text = ApplicationSettings.Default.HardwareKey; // Proxy Tab textBoxProxyUser.Text = ApplicationSettings.Default.ProxyUser; maskedTextBoxProxyPass.Text = ApplicationSettings.Default.ProxyPassword; textBoxProxyDomain.Text = ApplicationSettings.Default.ProxyDomain; // Appearance Tab splashOverride.Text = ApplicationSettings.Default.SplashOverride; Debug.WriteLine("Loaded Options Form", "OptionForm"); }
/// <summary> /// Save settings /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonSaveSettings_Click(object sender, EventArgs e) { tbStatus.ResetText(); try { tbStatus.AppendText("Saving with CMS... Please wait..."); // Simple settings ApplicationSettings.Default.ServerKey = textBoxServerKey.Text; ApplicationSettings.Default.LibraryPath = textBoxLibraryPath.Text.TrimEnd('\\'); ApplicationSettings.Default.ServerUri = textBoxXmdsUri.Text; ApplicationSettings.Default.HardwareKey = tbHardwareKey.Text; // Also tweak the address of the xmds1 xmds1.Url = ApplicationSettings.Default.XiboClient_xmds_xmds; // Proxy Settings ApplicationSettings.Default.ProxyUser = textBoxProxyUser.Text; ApplicationSettings.Default.ProxyPassword = maskedTextBoxProxyPass.Text; ApplicationSettings.Default.ProxyDomain = textBoxProxyDomain.Text; // Change the default Proxy class OptionForm.SetGlobalProxy(); // Client settings ApplicationSettings.Default.SplashOverride = splashOverride.Text; // Commit these changes back to the user settings ApplicationSettings.Default.Save(); // Call register xmds1.RegisterDisplayAsync( ApplicationSettings.Default.ServerKey, ApplicationSettings.Default.HardwareKey, ApplicationSettings.Default.DisplayName, "windows", ApplicationSettings.Default.ClientVersion, ApplicationSettings.Default.ClientCodeVersion, Environment.OSVersion.ToString(), _hardwareKey.MacAddress, _hardwareKey.Channel, _hardwareKey.getXmrPublicKey()); } catch (Exception ex) { tbStatus.AppendText(ex.Message); } }
public OptionForm() { InitializeComponent(); Debug.WriteLine("Initialise Option Form Components", "OptionForm"); // Get a hardware key here, just in case we havent been able to get one before _hardwareKey = new HardwareKey(); // XMDS completed event xmds1.RegisterDisplayCompleted += new XiboClient.xmds.RegisterDisplayCompletedEventHandler(xmds1_RegisterDisplayCompleted); // Library Path if (ApplicationSettings.Default.LibraryPath == "DEFAULT") { Debug.WriteLine("Getting the Library Path", "OptionForm"); ApplicationSettings.Default.LibraryPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\Xibo Library"; ApplicationSettings.Default.Save(); } // Computer name if the display name hasnt been set yet if (ApplicationSettings.Default.DisplayName == "COMPUTERNAME") { Debug.WriteLine("Getting the display Name", "OptionForm"); ApplicationSettings.Default.DisplayName = Environment.MachineName; ApplicationSettings.Default.Save(); } // Set global proxy information OptionForm.SetGlobalProxy(); // Settings Tab textBoxXmdsUri.Text = ApplicationSettings.Default.ServerUri; textBoxServerKey.Text = ApplicationSettings.Default.ServerKey; textBoxLibraryPath.Text = ApplicationSettings.Default.LibraryPath; tbHardwareKey.Text = ApplicationSettings.Default.HardwareKey; // Proxy Tab textBoxProxyUser.Text = ApplicationSettings.Default.ProxyUser; maskedTextBoxProxyPass.Text = ApplicationSettings.Default.ProxyPassword; textBoxProxyDomain.Text = ApplicationSettings.Default.ProxyDomain; // Appearance Tab splashOverride.Text = ApplicationSettings.Default.SplashOverride; Debug.WriteLine("Loaded Options Form", "OptionForm"); }
public OptionForm() { InitializeComponent(); // Set the icon Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath); // Hide unnecessary fields if (Application.ProductName != "Xibo") { label17.Hide(); linkLabel1.Hide(); } // Get a hardware key here, just in case we havent been able to get one before _hardwareKey = new HardwareKey(); // XMDS completed event xmds1.RegisterDisplayCompleted += new XiboClient.xmds.RegisterDisplayCompletedEventHandler(xmds1_RegisterDisplayCompleted); // Set global proxy information OptionForm.SetGlobalProxy(); // Settings Tab textBoxXmdsUri.Text = ApplicationSettings.Default.ServerUri; textBoxServerKey.Text = ApplicationSettings.Default.ServerKey; textBoxLibraryPath.Text = ApplicationSettings.Default.LibraryPath; tbHardwareKey.Text = ApplicationSettings.Default.HardwareKey; // Proxy Tab textBoxProxyUser.Text = ApplicationSettings.Default.ProxyUser; maskedTextBoxProxyPass.Text = ApplicationSettings.Default.ProxyPassword; textBoxProxyDomain.Text = ApplicationSettings.Default.ProxyDomain; // Appearance Tab splashOverride.Text = ApplicationSettings.Default.SplashOverride; // Switch to TLS 2.1 System.Net.ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12; Debug.WriteLine("Loaded Options Form", "OptionForm"); }
private void InitializeXibo() { Thread.CurrentThread.Name = "UI Thread"; // Default the XmdsConnection ApplicationSettings.Default.XmdsLastConnection = DateTime.MinValue; // Override the default size if necessary if (ApplicationSettings.Default.SizeX != 0) { _clientSize = new Size((int)ApplicationSettings.Default.SizeX, (int)ApplicationSettings.Default.SizeY); Size = _clientSize; WindowState = FormWindowState.Normal; Location = new Point((int)ApplicationSettings.Default.OffsetX, (int)ApplicationSettings.Default.OffsetY); StartPosition = FormStartPosition.Manual; } else { _clientSize = SystemInformation.PrimaryMonitorSize; ApplicationSettings.Default.SizeX = _clientSize.Width; ApplicationSettings.Default.SizeY = _clientSize.Height; } // Show in taskbar ShowInTaskbar = ApplicationSettings.Default.ShowInTaskbar; // Setup the proxy information OptionForm.SetGlobalProxy(); _statLog = new StatLog(); this.FormClosing += new FormClosingEventHandler(MainForm_FormClosing); this.Shown += new EventHandler(MainForm_Shown); // Create the info form _clientInfoForm = new ClientInfo(); _clientInfoForm.Hide(); // Add a message filter to listen for the i key Application.AddMessageFilter(KeyStore.Instance); // Define the hotkey Keys key; try { key = (Keys)Enum.Parse(typeof(Keys), ApplicationSettings.Default.ClientInformationKeyCode.ToUpper()); } catch { // Default back to I key = Keys.I; } KeyStore.Instance.AddKeyDefinition("ClientInfo", key, ((ApplicationSettings.Default.ClientInfomationCtrlKey) ? Keys.Control : Keys.None)); // Register a handler for the key event KeyStore.Instance.KeyPress += Instance_KeyPress; // Trace listener for Client Info ClientInfoTraceListener clientInfoTraceListener = new ClientInfoTraceListener(_clientInfoForm); clientInfoTraceListener.Name = "ClientInfo TraceListener"; Trace.Listeners.Add(clientInfoTraceListener); // Log to disk? if (!string.IsNullOrEmpty(ApplicationSettings.Default.LogToDiskLocation)) { TextWriterTraceListener listener = new TextWriterTraceListener(ApplicationSettings.Default.LogToDiskLocation); Trace.Listeners.Add(listener); } Trace.WriteLine(new LogMessage("MainForm", "Client Initialised"), LogType.Info.ToString()); }
private void InitializeXibo() { Thread.CurrentThread.Name = "UI Thread"; // Check the directories exist if (!Directory.Exists(ApplicationSettings.Default.LibraryPath) || !Directory.Exists(ApplicationSettings.Default.LibraryPath + @"\backgrounds\")) { // Will handle the create of everything here Directory.CreateDirectory(ApplicationSettings.Default.LibraryPath + @"\backgrounds"); } // Default the XmdsConnection ApplicationSettings.Default.XmdsLastConnection = DateTime.MinValue; // Override the default size if necessary if (ApplicationSettings.Default.SizeX != 0) { _clientSize = new Size((int)ApplicationSettings.Default.SizeX, (int)ApplicationSettings.Default.SizeY); Size = _clientSize; WindowState = FormWindowState.Normal; Location = new Point((int)ApplicationSettings.Default.OffsetX, (int)ApplicationSettings.Default.OffsetY); StartPosition = FormStartPosition.Manual; } else { _clientSize = SystemInformation.PrimaryMonitorSize; ApplicationSettings.Default.SizeX = _clientSize.Width; ApplicationSettings.Default.SizeY = _clientSize.Height; } // Show in taskbar ShowInTaskbar = ApplicationSettings.Default.ShowInTaskbar; // Setup the proxy information OptionForm.SetGlobalProxy(); _statLog = new StatLog(); this.FormClosing += new FormClosingEventHandler(MainForm_FormClosing); this.Shown += new EventHandler(MainForm_Shown); // Create the info form _clientInfoForm = new ClientInfo(); _clientInfoForm.Hide(); // Define the hotkey Keys key; try { key = (Keys)Enum.Parse(typeof(Keys), ApplicationSettings.Default.ClientInformationKeyCode.ToUpper()); } catch { // Default back to I key = Keys.I; } KeyStore.Instance.AddKeyDefinition("ClientInfo", key, ((ApplicationSettings.Default.ClientInfomationCtrlKey) ? Keys.Control : Keys.None)); // Register a handler for the key event KeyStore.Instance.KeyPress += Instance_KeyPress; // Trace listener for Client Info ClientInfoTraceListener clientInfoTraceListener = new ClientInfoTraceListener(_clientInfoForm); clientInfoTraceListener.Name = "ClientInfo TraceListener"; Trace.Listeners.Add(clientInfoTraceListener); // Log to disk? if (!string.IsNullOrEmpty(ApplicationSettings.Default.LogToDiskLocation)) { TextWriterTraceListener listener = new TextWriterTraceListener(ApplicationSettings.Default.LogToDiskLocation); Trace.Listeners.Add(listener); } #if !DEBUG // Initialise the watchdog if (!_screenSaver) { try { // Update/write the status.json file File.WriteAllText(Path.Combine(ApplicationSettings.Default.LibraryPath, "status.json"), "{\"lastActivity\":\"" + DateTime.Now.ToString() + "\"}"); // Start watchdog WatchDogManager.Start(); } catch (Exception e) { Trace.WriteLine(new LogMessage("MainForm - InitializeXibo", "Cannot start watchdog. E = " + e.Message), LogType.Error.ToString()); } } #endif Trace.WriteLine(new LogMessage("MainForm", "Client Initialised"), LogType.Info.ToString()); }
private void InitializeXibo() { this.Text = Application.ProductName; Thread.CurrentThread.Name = "UI Thread"; // Check the directories exist if (!Directory.Exists(ApplicationSettings.Default.LibraryPath + @"\backgrounds\")) { // Will handle the create of everything here Directory.CreateDirectory(ApplicationSettings.Default.LibraryPath + @"\backgrounds"); } // Default the XmdsConnection ApplicationSettings.Default.XmdsLastConnection = DateTime.MinValue; // Set the Main Window Size SetMainWindowSize(); // Bind to the resize event Microsoft.Win32.SystemEvents.DisplaySettingsChanged += SystemEvents_DisplaySettingsChanged; // Show in taskbar ShowInTaskbar = ApplicationSettings.Default.ShowInTaskbar; // Setup the proxy information OptionForm.SetGlobalProxy(); _statLog = new StatLog(); this.FormClosing += new FormClosingEventHandler(MainForm_FormClosing); this.Shown += new EventHandler(MainForm_Shown); // Create the info form _clientInfoForm = new ClientInfo(); _clientInfoForm.Hide(); // Define the hotkey Keys key; try { key = (Keys)Enum.Parse(typeof(Keys), ApplicationSettings.Default.ClientInformationKeyCode.ToUpper()); } catch { // Default back to I key = Keys.I; } KeyStore.Instance.AddKeyDefinition("ClientInfo", key, ((ApplicationSettings.Default.ClientInfomationCtrlKey) ? Keys.Control : Keys.None)); // Register a handler for the key event KeyStore.Instance.KeyPress += Instance_KeyPress; // Trace listener for Client Info ClientInfoTraceListener clientInfoTraceListener = new ClientInfoTraceListener(_clientInfoForm); clientInfoTraceListener.Name = "ClientInfo TraceListener"; Trace.Listeners.Add(clientInfoTraceListener); // Log to disk? if (!string.IsNullOrEmpty(ApplicationSettings.Default.LogToDiskLocation)) { TextWriterTraceListener listener = new TextWriterTraceListener(ApplicationSettings.Default.LogToDiskLocation); Trace.Listeners.Add(listener); } #if !DEBUG // Initialise the watchdog if (!_screenSaver) { try { // Update/write the status.json file File.WriteAllText(Path.Combine(ApplicationSettings.Default.LibraryPath, "status.json"), "{\"lastActivity\":\"" + DateTime.Now.ToString() + "\"}"); // Start watchdog WatchDogManager.Start(); } catch (Exception e) { Trace.WriteLine(new LogMessage("MainForm - InitializeXibo", "Cannot start watchdog. E = " + e.Message), LogType.Error.ToString()); } } #endif // An empty set of overlay regions _overlays = new Collection <Region>(); Trace.WriteLine(new LogMessage("MainForm", "Client Initialised"), LogType.Info.ToString()); }