/// <summary> /// Creates all the controls and fills it with data from settings file /// </summary> /// <param name="logic">ClientLogic object used to control the window</param> public MainWindow(ClientLogic logic) { this.logic = logic; this.SuspendLayout(); this.ClientSize = new Size(450, 400); this.Name = "MainWindow"; this.Text = "WinRVClient"; this.FormBorderStyle = FormBorderStyle.FixedSingle; this.MaximizeBox = false; InitializeComponent(); this.ResumeLayout(false); // Previous / Default settings loader SettingsTab.ConnectionSettingsStruct c; RVClient.StreamDataV1[] s; if (this.logic.LoadSettings(this, out c, out s)) { // TODO This way settings loaded from file are not validated. // Probably we should somehow handle. Hovewer, methods with validation // logic are inside SettingsTab. Maybe it was wrong design concept // but made it easier to mark controls where the problem occurs. this.ConnectionData = c; this.StreamData = s; } }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); ClientLogic logic = new ClientLogic(); MainWindow window = new MainWindow(logic); window.Icon = WinRVClient.Properties.Resources.winrvclient; logic.InitializeState(window); Application.Run(window); }