1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-05-03 23: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{
get{
return WindowLocation.X != 32000;
return WindowLocation.X != -32000;
}
}
public bool IsCustomNotificationPositionSet{
get{
return CustomNotificationPosition.X != 32000;
return CustomNotificationPosition.X != -32000;
}
}
@ -45,10 +45,10 @@ private UserConfig(string file){
this.file = file;
IsMaximized = true;
WindowLocation = new Point(32000,32000);
WindowLocation = new Point(-32000,-32000);
NotificationDuration = TweetNotification.Duration.Medium;
NotificationPosition = TweetNotification.Position.TopRight;
CustomNotificationPosition = new Point(32000,32000);
CustomNotificationPosition = new Point(-32000,-32000);
NotificationEdgeDistance = 8;
}

View File

@ -31,7 +31,7 @@ private void InitializeComponent() {
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
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.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.ResizeEnd += new System.EventHandler(this.FormBrowser_ResizeEnd);

View File

@ -23,6 +23,7 @@ private static UserConfig Config{
private FormSettings currentFormSettings;
private FormAbout currentFormAbout;
private bool isLoaded;
public FormBrowser(){
InitializeComponent();
@ -72,6 +73,8 @@ private void SetupWindow(){
Size = Screen.PrimaryScreen.WorkingArea.Size;
WindowState = FormWindowState.Maximized;
}
isLoaded = true;
}
// 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
if (!isLoaded)return;
Config.WindowLocation = Location;
Config.WindowSize = Size;
Config.Save();
}
private void FormBrowser_WindowStateChanged(object sender, EventArgs e){
if (!isLoaded)return;
Config.IsMaximized = WindowState != FormWindowState.Normal;
FormBrowser_ResizeEnd(sender,e);
}

View File

@ -65,7 +65,7 @@ private void InitializeComponent() {
this.Controls.Add(this.progressBarTimer);
this.Controls.Add(this.panelBrowser);
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.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;

View File

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