| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Timers;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Shapes;
- namespace ivf_tl_Operate.Windows
- {
- /// <summary>
- /// MessagePrompt.xaml 的交互逻辑
- /// </summary>
- public partial class MessagePrompt : Window
- {
- private Window parent = null;
- public System.Timers.Timer timer;
- public MessagePrompt()
- {
- InitializeComponent();
- this.Topmost = true;
- timer = new System.Timers.Timer(1500);
- timer.Enabled = false;
- timer.AutoReset = false;
- timer.Elapsed -= timer_Elapsed;
- timer.Elapsed += timer_Elapsed;
- this.Closed += (a, b) =>
- {
- if (parent != null)
- {
- parent.Activate();
- }
- };
- }
- private void timer_Elapsed(object sender, ElapsedEventArgs e)
- {
- timer.Enabled = false;
- timer.Close();
- timer.Dispose();
- Dispatcher.Invoke(() =>
- {
- this.Close();
- });
- }
- public void ShowCenterOwnerSuccess(Window parent, string mess)
- {
- timer.Start();
- this.Owner = parent;
- this.parent = parent;
- this._icon_Image.Visibility = Visibility.Visible;
- this._conent_Border.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#009648"));
- this.text.Text = mess;
- this.WindowStartupLocation = WindowStartupLocation.CenterOwner;
- this.Show();
- }
- /// <summary>
- /// 操作失败弹窗 在窗口的中间
- /// </summary>
- /// <param name="parent"></param>
- public void ShowCenterOwnerDefeat(Window parent, string mess)
- {
- timer.Start();
- this.Owner = parent;
- this.parent = parent;
- this.text.Text = mess;
- this.WindowStartupLocation = WindowStartupLocation.CenterOwner;
- this.Show();
- }
- }
- }
|