This is a TaskbarNotifier that contains a list of NotifyObjects to be displayed.
Inheritance: WPFTaskbarNotifier.TaskbarNotifier
示例#1
0
        public Window1()
        {
            this.taskbarNotifier = new ExampleTaskbarNotifier();

            InitializeComponent();

            this.taskbarNotifier.Show();
        }
示例#2
0
        public async void Start(object sender, StartupEventArgs e)
        {
            try
            {
                Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
                Assembly curAssembly            = Assembly.GetExecutingAssembly();
                key.SetValue(curAssembly.GetName().Name, curAssembly.Location);
            }
            catch
            {
            }

            _cts = new CancellationTokenSource();
            var window = new ExampleTaskbarNotifier();

            _runningTask = _service.RunAsync(window, _cts.Token);

            // show window
            window.Topmost = true;
            window.Show();

            //return Task.CompletedTask;
        }
        private void OnMessage(TaskMessage message,int projectId)
        {
            taskbarNotifier = new ExampleTaskbarNotifier();
            taskbarNotifier.Show();
            taskbarNotifier.ShowInTaskbar = true;
            taskbarNotifier.OpeningMilliseconds = 1000;
            taskbarNotifier.StayOpenMilliseconds = 7000000;
            taskbarNotifier.HidingMilliseconds = 1000;
            // Starts a new conversation with message.From if not started,
            // otherwise, it will add a message to the conversation window with message.From.
            this.taskbarNotifier.NotifyContent.Add(new NotifyObject(message.Description,projectId));//DateTime.Today.ToString(CultureInfo.InvariantCulture)));

            // Tell the TaskbarNotifier to open.
            this.taskbarNotifier.Notify();

            taskbarNotifier.ShowInTaskbar = true;
        }