public AlterWin(WindowStyleBase winStyle)
 {
     InitializeComponent();
     this.ShowInTaskbar = false;
     if (winStyle.WinStartType == WindowStartLocationType.CenterScreen)
     {
         this.WindowStartupLocation = WindowStartupLocation.CenterScreen;
     }
     else
     {
         this.WindowStartupLocation = WindowStartupLocation.Manual;
         this.Left = winStyle.Pis_X;
         this.Top  = winStyle.Pis_Y;
     }
 }
 public ConfirmWin(WindowStyleBase winStyle)
 {
     InitializeComponent();
     this.ShowInTaskbar = false;
     if (winStyle.WinStartType == WindowStartLocationType.CenterScreen)
     {
         this.WindowStartupLocation = WindowStartupLocation.CenterScreen;
     }
     else
     {
         this.Left = winStyle.Pis_X;
         this.Top  = winStyle.Pis_Y;
         //Rect rc = SystemParameters.WorkArea;//获取工作区大小
         //this.WindowStartupLocation = WindowStartupLocation.Manual;
         //if (winStyle.Pis_X + winStyle.Width > rc.Width)
         //{
         //    if (winStyle.Pis_Y < rc.Height-winStyle.Height)
         //    {
         //        this.Left = winStyle.Pis_X - winStyle.Width;
         //        this.Top = winStyle.Height;
         //    }
         //    else
         //    {
         //        this.Left = winStyle.Pis_X - winStyle.Width;
         //        this.Top = winStyle.Pis_Y;
         //    }
         //}
         //else if (winStyle.Pis_X < winStyle.Width)
         //{
         //    if (winStyle.Pis_Y < rc.Height - winStyle.Height)
         //    {
         //        this.Left = winStyle.Pis_X - winStyle.Width;
         //        this.Top = winStyle.Height;
         //    }
         //    else
         //    {
         //        this.Left = winStyle.Pis_X - winStyle.Width;
         //        this.Top = winStyle.Pis_Y;
         //    }
         //}
         //else
         //{
         //    this.Left = winStyle.Pis_X;
         //    this.Top = winStyle.Pis_Y;
         //}
     }
 }
Beispiel #3
0
 public static bool?AttachedWindowService(WindowStyleBase winStyle)
 {
     if (winStyle.Wintype == windowType.AlertWindow)
     {
         AlterWin alertwin = new AlterWin(winStyle);
         alertwin.Width        = winStyle.Width;
         alertwin.Height       = winStyle.Height;
         alertwin.WinTitle     = winStyle.Title;
         alertwin.WinContent   = winStyle.Description;
         alertwin.OkButtonText = winStyle.OkBtnText;
         return(alertwin.ShowDialog());
     }
     else
     {
         ConfirmWin confirWin = new ConfirmWin(winStyle);
         confirWin.Width            = winStyle.Width;
         confirWin.Height           = winStyle.Height;
         confirWin.WinTitle         = winStyle.Title;
         confirWin.WinContent       = winStyle.Description;
         confirWin.OkButtonText     = winStyle.OkBtnText;
         confirWin.CancleButtonText = winStyle.CancleBtnText;
         return(confirWin.ShowDialog());
     }
 }