1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-05-21 14:34:09 +02:00

Fix some issues with multi-monitor setups (change default loc, fix config saving before window loaded)

This commit is contained in:
chylex 2016-04-13 02:33:21 +02:00
parent f99435ff6a
commit 81c29ab50c
5 changed files with 14 additions and 7 deletions

View File

@ -26,13 +26,13 @@ sealed class UserConfig{
public bool IsCustomWindowLocationSet{ public bool IsCustomWindowLocationSet{
get{ get{
return WindowLocation.X != 32000; return WindowLocation.X != -32000;
} }
} }
public bool IsCustomNotificationPositionSet{ public bool IsCustomNotificationPositionSet{
get{ get{
return CustomNotificationPosition.X != 32000; return CustomNotificationPosition.X != -32000;
} }
} }
@ -45,10 +45,10 @@ private UserConfig(string file){
this.file = file; this.file = file;
IsMaximized = true; IsMaximized = true;
WindowLocation = new Point(32000,32000); WindowLocation = new Point(-32000,-32000);
NotificationDuration = TweetNotification.Duration.Medium; NotificationDuration = TweetNotification.Duration.Medium;
NotificationPosition = TweetNotification.Position.TopRight; NotificationPosition = TweetNotification.Position.TopRight;
CustomNotificationPosition = new Point(32000,32000); CustomNotificationPosition = new Point(-32000,-32000);
NotificationEdgeDistance = 8; NotificationEdgeDistance = 8;
} }

View File

@ -31,7 +31,7 @@ private void InitializeComponent() {
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Icon = TweetDick.Properties.Resources.icon; this.Icon = TweetDick.Properties.Resources.icon;
this.Location = new System.Drawing.Point(32000, 32000); this.Location = new System.Drawing.Point(-32000, -32000);
this.Name = "FormBrowser"; this.Name = "FormBrowser";
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.ResizeEnd += new System.EventHandler(this.FormBrowser_ResizeEnd); this.ResizeEnd += new System.EventHandler(this.FormBrowser_ResizeEnd);

View File

@ -23,6 +23,7 @@ private static UserConfig Config{
private FormSettings currentFormSettings; private FormSettings currentFormSettings;
private FormAbout currentFormAbout; private FormAbout currentFormAbout;
private bool isLoaded;
public FormBrowser(){ public FormBrowser(){
InitializeComponent(); InitializeComponent();
@ -72,6 +73,8 @@ private void SetupWindow(){
Size = Screen.PrimaryScreen.WorkingArea.Size; Size = Screen.PrimaryScreen.WorkingArea.Size;
WindowState = FormWindowState.Maximized; WindowState = FormWindowState.Maximized;
} }
isLoaded = true;
} }
// active event handlers // active event handlers
@ -94,12 +97,16 @@ private void Browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e){
} }
private void FormBrowser_ResizeEnd(object sender, EventArgs e){ // also triggers when the window moves private void FormBrowser_ResizeEnd(object sender, EventArgs e){ // also triggers when the window moves
if (!isLoaded)return;
Config.WindowLocation = Location; Config.WindowLocation = Location;
Config.WindowSize = Size; Config.WindowSize = Size;
Config.Save(); Config.Save();
} }
private void FormBrowser_WindowStateChanged(object sender, EventArgs e){ private void FormBrowser_WindowStateChanged(object sender, EventArgs e){
if (!isLoaded)return;
Config.IsMaximized = WindowState != FormWindowState.Normal; Config.IsMaximized = WindowState != FormWindowState.Normal;
FormBrowser_ResizeEnd(sender,e); FormBrowser_ResizeEnd(sender,e);
} }

View File

@ -65,7 +65,7 @@ private void InitializeComponent() {
this.Controls.Add(this.progressBarTimer); this.Controls.Add(this.progressBarTimer);
this.Controls.Add(this.panelBrowser); this.Controls.Add(this.panelBrowser);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Location = new System.Drawing.Point(32000, 32000); this.Location = new System.Drawing.Point(-32000, -32000);
this.Name = "FormNotification"; this.Name = "FormNotification";
this.ShowInTaskbar = false; this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;

View File

@ -78,7 +78,7 @@ public void ShowNotificationForSettings(bool resetAnimation){
public void HideNotification(){ public void HideNotification(){
browser.LoadHtml("","about:blank"); browser.LoadHtml("","about:blank");
Location = new Point(32000,32000); Location = new Point(-32000,-32000);
TopMost = false; TopMost = false;
timerProgress.Stop(); timerProgress.Stop();
} }