private void init(string _path, WatchingObjectType _wType, TaskbarIcon _tb, Image _item_image, ControlButtons _buttons) { tb = _tb; item_image = _item_image; Image img = ((Image)this.FindName("item_image")); if (_item_image != null) { img.Source = _item_image.Source; } this.path = _path; this.text_message.Text = _path; this.wType = _wType; temp = new System.Timers.Timer(); temp.Interval = 2000; temp.Elapsed += new System.Timers.ElapsedEventHandler(customballoon_close); Button btn_copy_clipboard = ((Button)this.FindName("btn_copy_clipboard")); btn_copy_clipboard.Click += (sender, args) => { if (tb.CustomBalloon != null) { tb.CustomBalloon.IsOpen = false; } App.copy_clipboard_with_popup(_path); }; if ((_buttons & ControlButtons.Clipboard) == 0) { btn_copy_clipboard.Visibility = Visibility.Hidden; } Button btn_execute_file = ((Button)this.FindName("btn_execute_file")); btn_execute_file.Click += (sender, args) => { if (tb.CustomBalloon != null) { tb.CustomBalloon.IsOpen = false; } if (File.Exists(_path) == true) { Process.Start(_path); } else { App.ShowMessage($"Файл {_path} ещё не загружен или удалён."); } }; if ((_buttons & ControlButtons.Run) == 0) { btn_execute_file.Visibility = Visibility.Hidden; } this.MouseEnter += (sender, args) => { tb.ResetBalloonCloseTimer(); this.Background = new SolidColorBrush(Color.FromArgb(0xFF, 0x04, 0x7A, 0x95)); //this.Visibility = Visibility.Hidden; if (temp.Enabled) { temp.Stop(); } }; this.MouseLeave += (sender, args) => { this.Background = new SolidColorBrush(Color.FromArgb(0xCC, 0x00, 0xAB, 0xD1)); temp.Start(); }; /* * this.MouseDown += (sender, args) => * { * tb.CustomBalloon.IsOpen = false; * //this.Visibility = Visibility.Hidden; * App.gotoPathByWindowsExplorer(path, wType); * }; * //*/ this.ToolTipClosing += (sender, args) => { temp.Stop(); }; }
/* * public TrayPopupMessage(string _path, WatchingObjectType _wType, TaskbarIcon _tb, ControlButtons _buttons) * { * InitializeComponent(); * init(_path, _wType, _tb, _buttons); * } * //*/ public TrayPopupMessage(string _path, string _title, WatchingObjectType _wType, TaskbarIcon _tb, Image _item_image, ControlButtons _buttons) { InitializeComponent(); this.title.Text = _title; init(_path, _wType, _tb, _item_image, _buttons); }