Пример #1
0
        private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            switch ((sender as ComboBox).SelectedIndex)
            {
            case 0:
                _notify = new Action(() => _manager.Notify("Hello", "Toast"));
                break;

            case 1:
                _notify = new Action(() => _manager.Notify("Hello", "Toast", new ToastCommands {
                    Content = "OK", Argument = "OKarg"
                }, new ToastCommands {
                    Content = "NO", Argument = "NOarg"
                }));
                break;

            case 2:
                _notify = new Action(() => _manager.Notify("Hello", "Toast", new ToastCommands[] { new ToastCommands {
                                                                                                       Content = "Input", Argument = "input"
                                                                                                   } }, new ToastCommands[] { new ToastCommands {
                                                                                                                                  Content = "Reply", Argument = "btn"
                                                                                                                              } }));
                break;
            }
        }
Пример #2
0
 private void ClipboardChanged(object sender, EventArgs e)
 {
     if (Clipboard.ContainsImage() && Common.IsPausingScan == false)
     {
         Bitmap image = null;
         try { image = BitmapFromSource(Clipboard.GetImage()); } catch {
             try { image = (Bitmap)Image.FromFile(Clipboard.GetFileDropList()[0]); } catch
             {
                 image = null;
             }
         }
         if (image != null)
         {
             IBarcodeReader reader        = new BarcodeReader();
             var            barcodeBitmap = image;
             var            result        = reader.Decode(barcodeBitmap);
             if (result != null)
             {
                 if (result.Text.ToLower().StartsWith("http://") || result.Text.ToLower().StartsWith("https://"))
                 {
                     _notify = new Action(() => _manager.Notify("从剪贴板图片中读取到了二维码信息", result.Text, new ToastCommands[] { new ToastCommands {
                                                                                                                           Content = "复制", Argument = "copy:" + result.Text
                                                                                                                       } }, new ToastCommands[] { new ToastCommands {
                                                                                                                                                      Content = "前往", Argument = "goUrl:" + result.Text
                                                                                                                                                  } }));;;
                 }
                 else
                 {
                     _notify = new Action(() => _manager.Notify("从剪贴板图片中读取到了二维码信息", result.Text, new ToastCommands[] { new ToastCommands {
                                                                                                                           Content = "复制", Argument = "copy:" + result.Text
                                                                                                                       } }, new ToastCommands[] { new ToastCommands {
                                                                                                                                                      Content = "忽略", Argument = "nothing"
                                                                                                                                                  } }));;;
                 }
                 _notify?.BeginInvoke(null, null);
             }
         }
     }
 }
Пример #3
0
 public MainWindow()
 {
     InitializeComponent();
     _manager = new ToastManager();
     _manager.Init <ToastManager>("ClipBoard Qr Helper");
     ToastManager.ToastCallback += ToastManager_ToastCallback;
     GetRunningObjectTable(0, out this.rot);
     if (Common.IsSilence == false)
     {
         _notify = new Action(() => _manager.Notify("欢迎使用,我在托盘为你服务哦!", "ClipBoard Qr Helper"));;;
         _notify?.BeginInvoke(null, null);
     }
 }