public AWindow(IWindow owner) : base(owner, Core.settings) { TabItem from_me = new TabItem(); from_me.BeginInit(); from_me.EndInit(); this.Background = from_me.Background; ProgressBar from_color = new ProgressBar(); default_progress_color = from_color.Foreground; // Taskbar progress setup TaskbarItemInfo = new TaskbarItemInfo(); // var uriSource = new Uri(System.IO.Path.Combine(Core.ExecutablePath, "masgau.ico"), UriKind.Relative); System.Drawing.Icon ico = Properties.Resources.MASGAUIcon; this.Icon = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap( ico.ToBitmap().GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); if (owner != null) { this.Owner = owner as System.Windows.Window; this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner; } else { this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; } }
private static void SetDimensions(TabItem tabItem) { if (tabItem.Dimension == null) { // store the original size specifications of the tab tabItem.Dimension = new Dimension { Height = tabItem.Height, Width = tabItem.Width, MaxHeight = tabItem.MaxHeight, MaxWidth = tabItem.MaxWidth, MinHeight = tabItem.MinHeight, MinWidth = tabItem.MinWidth }; } else { // restore the original values for the tab tabItem.BeginInit(); tabItem.Height = tabItem.Dimension.Height; tabItem.Width = tabItem.Dimension.Width; tabItem.MaxHeight = tabItem.Dimension.MaxHeight; tabItem.MaxWidth = tabItem.Dimension.MaxWidth; tabItem.MinHeight = tabItem.Dimension.MinHeight; tabItem.MinWidth = tabItem.Dimension.MinWidth; tabItem.EndInit(); } }