/// <summary> /// Save settings /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonSaveSettings_Click(object sender, EventArgs e) { try { // Simple settings Settings.Default.ServerKey = textBoxServerKey.Text; Settings.Default.LibraryPath = textBoxLibraryPath.Text.TrimEnd('\\'); Settings.Default.serverURI = textBoxXmdsUri.Text; Settings.Default.collectInterval = numericUpDownCollect.Value; Settings.Default.powerpointEnabled = checkBoxPowerPoint.Checked; Settings.Default.statsEnabled = checkBoxStats.Checked; Settings.Default.Xmds = textBoxXmdsUri.Text.TrimEnd('/') + @"/data.asmx"; Settings.Default.hardwareKey = tbHardwareKey.Text; Settings.Default.scrollStepAmount = nupScrollStepAmount.Value; Settings.Default.EnableMouse = enableMouseCb.Checked; Settings.Default.DoubleBuffering = doubleBufferingCheckBox.Checked; // Also tweak the address of the xmds1 // xmds.Url = Settings.Default.Xmds; labelXmdsUrl.Text = Settings.Default.Xmds; // Proxy Settings Settings.Default.ProxyUser = textBoxProxyUser.Text; Settings.Default.ProxyPassword = maskedTextBoxProxyPass.Text; Settings.Default.ProxyDomain = textBoxProxyDomain.Text; // Change the default Proxy class OptionForm.SetGlobalProxy(); // Client settings Settings.Default.sizeX = clientWidth.Value; Settings.Default.sizeY = clientHeight.Value; Settings.Default.offsetX = offsetX.Value; Settings.Default.offsetY = offsetY.Value; // Advanced settings Settings.Default.expireModifiedLayouts = cbExpireModifiedLayouts.Checked; Settings.Default.emptyLayoutDuration = numericUpDownEmptyRegions.Value; // Commit these changes back to the user settings Settings.Default.Save(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public ClientManager() { // RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly; //Listeners TextWriterTraceListener[] listeners = new TextWriterTraceListener[] { new TextWriterTraceListener("log.txt"), new TextWriterTraceListener(Console.Out), }; Debug.Listeners.AddRange(listeners); EventHandler handler = null; this._schedulerTimer = new System.Timers.Timer(); this.ScheduleChangeLock = new object(); Instance = this; this.InitializeComponent(); if (!Directory.Exists(Settings.Default.LibraryPath) || !Directory.Exists(Settings.Default.LibraryPath + @"\backgrounds\")) { Directory.CreateDirectory(Settings.Default.LibraryPath + @"\backgrounds"); Directory.CreateDirectory(Settings.Default.LibraryPath + @"\Layouts"); Directory.CreateDirectory(Settings.Default.LibraryPath + @"\Uploads\Media"); } this.SetCacheManager(); this.ShowSplashScreen(); OptionForm.SetGlobalProxy(); if (handler == null) { handler = new EventHandler((y, t) => { this.Closing(); Environment.Exit(0); }); } base.Closed += handler; MyCommand.InputGestures.Add(new KeyGesture(Key.Q, ModifierKeys.Control)); base.CommandBindings.Add(new CommandBinding(MyCommand, new ExecutedRoutedEventHandler(this.MyCommandExecuted))); this.InitializeComponent(); Switcher.ClientManager = this; OptionForm.SetGlobalProxy(); this._statLog = new ClientApp.Core.StatLog(); Switcher.Switch(AdvertPlayer.Instance); this.StartMessageReceiveThread(); try { this._schedule = new ClientApp.Schedule(App.UserAppDataPath + @"\" + Settings.Default.ScheduleFile, Instance.CacheManager); this._schedule.ScheduleChangeEvent += new ClientApp.Schedule.ScheduleChangeDelegate(this.ScheduleScheduleChangeEvent); this._schedule.InitializeComponents(); } catch (Exception) { MessageBox.Show("Fatal Error initialising eAd", "Fatal Error"); Environment.Exit(0); } Charging instance = Charging.Instance; LoadingProfile profile1 = LoadingProfile.Instance; //Todo: Make this an option ... Lower fps of app Timeline.DesiredFrameRateProperty.OverrideMetadata( typeof(Timeline), new FrameworkPropertyMetadata { DefaultValue = 20 } ); }
public OptionForm() { InitializeComponent(); System.Diagnostics.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 xmds.RegisterDisplayCompleted += (Xmds1RegisterDisplayCompleted); // Library Path if (Settings.Default.LibraryPath == "DEFAULT") { Debug.WriteLine("Getting the Library Path", "OptionForm"); Settings.Default.LibraryPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\ Library"; Settings.Default.Save(); } // Computer name if the display name hasnt been set yet if (Settings.Default.displayName == "COMPUTERNAME") { Debug.WriteLine("Getting the display Name", "OptionForm"); Settings.Default.displayName = Environment.MachineName; Settings.Default.Save(); } // Set global proxy information OptionForm.SetGlobalProxy(); // Settings Tab textBoxXmdsUri.Text = Settings.Default.serverURI; textBoxServerKey.Text = Settings.Default.ServerKey; textBoxLibraryPath.Text = Settings.Default.LibraryPath; tbHardwareKey.Text = Settings.Default.hardwareKey; numericUpDownCollect.Value = Settings.Default.collectInterval; checkBoxPowerPoint.Checked = Settings.Default.powerpointEnabled; checkBoxStats.Checked = Settings.Default.statsEnabled; nupScrollStepAmount.Value = Settings.Default.scrollStepAmount; // Register Tab labelXmdsUrl.Text = Settings.Default.Xmds; textBoxDisplayName.Text = Settings.Default.displayName; // Proxy Tab textBoxProxyUser.Text = Settings.Default.ProxyUser; maskedTextBoxProxyPass.Text = Settings.Default.ProxyPassword; textBoxProxyDomain.Text = Settings.Default.ProxyDomain; // Client Tab clientWidth.Value = Settings.Default.sizeX; clientHeight.Value = Settings.Default.sizeY; offsetX.Value = Settings.Default.offsetX; offsetY.Value = Settings.Default.offsetY; // Advanced Tab numericUpDownEmptyRegions.Value = Settings.Default.emptyLayoutDuration; cbExpireModifiedLayouts.Checked = Settings.Default.expireModifiedLayouts; enableMouseCb.Checked = Settings.Default.EnableMouse; doubleBufferingCheckBox.Checked = Settings.Default.DoubleBuffering; System.Diagnostics.Debug.WriteLine("Loaded Options Form", "OptionForm"); }
public ClientManager() { Instance = this; InitializeComponent(); // Check the directories exist if (!Directory.Exists(Settings.Default.LibraryPath) || !Directory.Exists(Settings.Default.LibraryPath + @"\backgrounds\")) { // Will handle the create of everything here Directory.CreateDirectory(Settings.Default.LibraryPath + @"\backgrounds"); Directory.CreateDirectory(Settings.Default.LibraryPath + @"\Layouts"); Directory.CreateDirectory(Settings.Default.LibraryPath + @"\Uploads\Media"); } // Create a cachemanager SetCacheManager(); ShowSplashScreen(); // Change the default Proxy class OptionForm.SetGlobalProxy(); Closed += delegate { Closing(); Environment.Exit(0); }; MyCommand.InputGestures.Add(new KeyGesture(Key.Q, ModifierKeys.Control)); CommandBindings.Add(new CommandBinding(MyCommand, MyCommandExecuted)); InitializeComponent(); Switcher.ClientManager = this; Switcher.Switch(AdvertPlayer.Instance); var customerPage = CustomerPage.Instance; // Setup the proxy information OptionForm.SetGlobalProxy(); _statLog = new StatLog(); this.StartKeepAliveThread(); this.StartMessageReceiveThread(); try { // Create the Schedule _schedule = new Schedule(App.UserAppDataPath + "\\" + Settings.Default.ScheduleFile, ClientManager.Instance.CacheManager); // Bind to the schedule change event - notifys of changes to the schedule _schedule.ScheduleChangeEvent += ScheduleScheduleChangeEvent; // Initialize the other schedule components _schedule.InitializeComponents(); } catch (Exception ex) { Debug.WriteLine(ex.Message, LogType.Error.ToString()); MessageBox.Show("Fatal Error initialising AdvertPlayer", "Fatal Error"); Environment.Exit(0); } }