/// <summary> /// Creates the Region /// </summary> /// <param name="statLog"></param> /// <param name="cacheManager"></param> public Region(ref StatLog statLog, ref CacheManager cacheManager) { // Store the statLog _statLog = statLog; // Store the cache manager _cacheManager = cacheManager; //default options _options = new RegionOptions(); _options.width = 1024; _options.height = 768; _options.left = 0; _options.top = 0; _options.uri = null; Location = new System.Drawing.Point(_options.left, _options.top); Size = new System.Drawing.Size(_options.width, _options.height); BackColor = System.Drawing.Color.Transparent; if (ApplicationSettings.Default.DoubleBuffering) { SetStyle(ControlStyles.OptimizedDoubleBuffer, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true); } // Create a new BlackList for us to use _blackList = new BlackList(); }
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(); // 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()); }