public static void ShowSetting() { DialogSetting dialogSetting = Application.Current.Windows.OfType <DialogSetting>().FirstOrDefault(); if (dialogSetting == null) { dialogSetting = new DialogSetting(); dialogSetting.ShowDialog(); } else { dialogSetting.Activate(); } }
private void ShowSettingDialog() { DialogSetting ds = new DialogSetting(); ds.ClockOpacity = (int)(this.Opacity * 100); ds.BoxSize = this.w; ds.GridWidth = this.s; ds.AlwaysOnTop = this.onTop; ds.DrawType = this.drawType; ds.IsReverse = this.is1248; ds.ClockLocation = this.Location; ds.ClockColor = Global.ClockColor; ds.ShadowColor = Global.ShadowColor; ds.Icon = this.Icon; if (DialogResult.OK == ds.ShowDialog()) { double o = ds.ClockOpacity * 1.0 / 100; if (this.Opacity != o) { this.Opacity = o; } if (ds.BoxSize != w || ds.GridWidth != s) { this.w = ds.BoxSize; this.s = ds.GridWidth; ChangeSize(); } Point p = ds.ClockLocation; if (Math.Abs(p.X - this.Left) > 5 || Math.Abs(p.Y - this.Top) > 5) { this.Location = p; } this.is1248 = ds.IsReverse; this.onTop = ds.AlwaysOnTop; this.drawType = ds.DrawType; ChangeColor(ds.ClockColor, ds.ShadowColor); //DrawIcon(); SaveConfiguration(); } }