当前位置: 首页>>代码示例>>C#>>正文


C# TaskbarNotification.TaskbarIcon类代码示例

本文整理汇总了C#中Hardcodet.Wpf.TaskbarNotification.TaskbarIcon的典型用法代码示例。如果您正苦于以下问题:C# TaskbarIcon类的具体用法?C# TaskbarIcon怎么用?C# TaskbarIcon使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TaskbarIcon类属于Hardcodet.Wpf.TaskbarNotification命名空间,在下文中一共展示了TaskbarIcon类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnStartup

        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            // Create a new instance of the main window.
            var mainWindow = new MainWindow();
            Application.Current.MainWindow = mainWindow;

            if (e.Args.Any(arg => arg.ToUpper().Equals("/refresh")))
            {
                mainWindow.Refresh();
            }

            //create the notifyicon (it's a resource declared in SystemTray/SystemTrayResources.xaml).
            _taskBarIcon = (TaskbarIcon)FindResource("SystemTrayIcon");

            // Register the hot-key that will show the application
            HotKeyManager.Register(
                Key.Space,
                OperatingSystem.KeyModifier.Alt,
                () =>
                    {
                        var command = GlobalCommands.ShowWindowCommand();

                        if (command.CanExecute(null))
                        {
                            command.Execute(null);
                        }
                    });
        }
开发者ID:hrudham,项目名称:Quicken,代码行数:30,代码来源:App.xaml.cs

示例2: CustomBalloon

 public CustomBalloon([NotNull] TaskbarIcon taskbarIcon)
 {
     if (taskbarIcon == null) throw new ArgumentNullException(nameof(taskbarIcon));
     InitializeComponent();
     
     _taskbarIcon = taskbarIcon;
 }
开发者ID:Iyemon-018,项目名称:Dev,代码行数:7,代码来源:CustomBalloon.xaml.cs

示例3: OnStartup

        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            //create the notifyicon (it's a resource declared in NotifyIconResources.xaml
            notifyIcon = (TaskbarIcon) FindResource("NotifyIcon");
        }
开发者ID:gitter-badger,项目名称:Infoscreen,代码行数:7,代码来源:App.xaml.cs

示例4: OnStartup

        protected override void OnStartup(StartupEventArgs e)
        {
            bool mutexIsAvailable = false;
            
            try
            {
                _lock = new Mutex(true, "Smaller.Singleton");
                mutexIsAvailable = _lock.WaitOne(1, false); // wait only 1 ms
            }
            catch (AbandonedMutexException)
            {
                //In case the previous instance did not correctly release the mutex, ignore the error.
                mutexIsAvailable = true;
            }

            if (!mutexIsAvailable)
            {
                RunJobController.Instance.TriggerRunJobs();
                Current.Shutdown();
                return;
            }
            else
            {
                base.OnStartup(e);

                //create the notifyicon (it's a resource declared in NotifyIconResources.xaml
                notifyIcon = (TaskbarIcon)FindResource("NotifyIcon");

                RunJobController.Instance.TriggerRunJobs();
            }
        }
开发者ID:geoffles,项目名称:Smaller,代码行数:31,代码来源:App.xaml.cs

示例5: OnStartup

        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);
            ShutdownMode = ShutdownMode.OnExplicitShutdown;

            _notificationIcon = (TaskbarIcon)FindResource("NotificationWebViewIcon");
        }
开发者ID:xcjs,项目名称:NotificationWebView,代码行数:7,代码来源:App.xaml.cs

示例6: AddTaskbarIcon

        // Adds the notification icon
        public void AddTaskbarIcon()
        {
            // The display text of the icon
            string DisplayText = "MouseControl running at " + WebServer.runningIp;
            systemIcon = new TaskbarIcon();
            systemIcon.Icon = new System.Drawing.Icon(typeof(App), "MouseControlIcon.ico");
            systemIcon.ToolTipText = DisplayText;
            systemIcon.ShowBalloonTip("MouseControl", DisplayText, BalloonIcon.Info);

            // Remove the text after a certain amount of time
            Thread.Sleep(6000);
            systemIcon.HideBalloonTip();

            // Add context menu
            ContextMenu cMenu = new ContextMenu();

            MenuItem about = new MenuItem();
            about.Header = "About";
            about.Click += aboutClick;

            MenuItem exit = new MenuItem();
            exit.Header = "Exit";
            exit.Click += exitClick;

            cMenu.Items.Add(about);
            cMenu.Items.Add(exit);

            // Add System tray icon click handler
            systemIcon.TrayMouseDoubleClick += SystemTrayIconClick;

            systemIcon.ContextMenu = cMenu;
        }
开发者ID:jamest222,项目名称:MouseControl,代码行数:33,代码来源:MainWindow.xaml.cs

示例7: AddTrayIconWpf

        private void AddTrayIconWpf() {
            Application.Current.Dispatcher.Invoke(() => {
                var rhm = new MenuItem { Header = "RHM Settings", Command = RhmService.Instance.ShowSettingsCommand };
                rhm.SetBinding(UIElement.VisibilityProperty, new Binding {
                    Source = RhmService.Instance,
                    Path = new PropertyPath(nameof(RhmService.Active))
                });

                var restore = new MenuItem { Header = UiStrings.Restore };
                var close = new MenuItem { Header = UiStrings.Close };

                restore.Click += RestoreMenuItem_Click;
                close.Click += CloseMenuItem_Click;

                _icon = new TaskbarIcon {
                    Icon = AppIconService.GetTrayIcon(),
                    ToolTipText = AppStrings.Hibernate_TrayText,
                    ContextMenu = new ContextMenu {
                        Items = {
                            rhm,
                            restore,
                            new Separator(),
                            close
                        }
                    },
                    DoubleClickCommand = new DelegateCommand(WakeUp)
                };

            });
        }
开发者ID:gro-ove,项目名称:actools,代码行数:30,代码来源:AppHibernator.TaskbarIcon.cs

示例8: TrayWindowViewModel

        public TrayWindowViewModel(TaskbarIcon taskbarIcon)
        {
            _taskbarIcon = taskbarIcon;

            ExitCommand = new ExitCommand();
            ShowCommand = new ShowAllCommand();
            HideCommand = new HideAllCommand();
            AddRepoCommand = new AddRepositoryCommand();

            ShowAboutCommand = new ShowSingleViewCommand(typeof(AboutView));

            LeftClickCommand = new ToggleShowHideCommand();
            DoubleClickCommand = LeftClickCommand;

            ShowSettingsCommand = new ShowSingleViewCommand(typeof(SettingsView));
#if DEBUG
            ShowSettingsVisiblilty = "Visible";
#else
            ShowSettingsVisiblilty = "Collapsed";
#endif

            ShowUpdateCommand = new ShowSingleViewCommand(typeof(UpdateView));
            CheckUpdateCommand = ShowUpdateCommand;

            HotkeyHelper.OnHotkeyChanged += (sender, args) => OnPropertyChanged("ShowHideHeader");
            // todo: currently the only balloon is for update, so no distinction about what to do.
            _taskbarIcon.TrayBalloonTipClicked += (sender, args) => ShowUpdateCommand.Execute(null);
            UpdateManager.OnUpdateRequired += UpdateManager_OnUpdateRequired;
            UpdateManager.OnUpdateInfoChanged += delegate(object sender, EventArgs args)
            {
                OnPropertyChanged("CheckUpdateHeader");
                OnPropertyChanged("ToolTipText");
            };

        }
开发者ID:tbener,项目名称:DiGit,代码行数:35,代码来源:TrayWindowViewModel.cs

示例9: OnStartup

        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            try
            {
                _settings = SerializationHelper.LoadObjectFromFile<AmbilightSettings>(PATH_SETTINGS) ??
                    new AmbilightSettings();
                IScreenCapture screenCapture = new DX9ScreenCapture();

                // DarthAffe 05.11.2016: This could be done way cleaner ...
                _taskBar = FindResource("Taskbar") as TaskbarIcon;
                FrameworkElement configView = _taskBar?.TrayPopup as ConfigView;
                if (configView == null)
                    Shutdown();
                else
                    configView.DataContext = new ConfigViewModel(_settings);

                _ambilight = new Ambilight(screenCapture, _settings);
                if (!_ambilight.Initialize())
                    throw new ApplicationException();
            }
            catch
            {
                MessageBox.Show("An error occured while starting the Keyboard-Ambilight.\r\nPlease double check if CUE is running and 'Enable SDK' is checked.", "Can't start Keyboard-Ambilight");
                Shutdown();
            }
        }
开发者ID:DarthAffe,项目名称:CUE.NET,代码行数:28,代码来源:App.xaml.cs

示例10: App

 public App()
 {
     InitializeComponent();
     tb = (TaskbarIcon)FindResource("iNGenTaskbarIcon");
     tb.TrayMouseDoubleClick += tb_TrayMouseDoubleClick;
     Locator = new ViewModels.ViewModelLocator();
 }
开发者ID:Cronos79,项目名称:iNGEN-Ark-RCON-Desktop,代码行数:7,代码来源:App.xaml.cs

示例11: OnStartup

        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            notifyIcon = (TaskbarIcon)FindResource("NotifyIcon");

            notifyIcon.ShowBalloonTip("Beba Água", "Beba água iniciado!", BalloonIcon.Info);
        }
开发者ID:joaopgrassi,项目名称:Desktop-Water-Reminder,代码行数:8,代码来源:App.xaml.cs

示例12: InitializeIcon

 private void InitializeIcon()
 {
     _taskbarIcon = (TaskbarIcon) Application.Current.FindResource("NetWatcherNotify");
     if (_taskbarIcon != null)
     {
         _taskbarIcon.DataContext = this;
     }
 }
开发者ID:PhilipRieck,项目名称:RdpIpUpd,代码行数:8,代码来源:NotifyViewModel.cs

示例13: AutotrackerNotification

        public AutotrackerNotification(TaskbarIcon icon, MainWindow mainWindow)
        {
            this.icon = icon;
            this.mainWindow = mainWindow;
            this.InitializeComponent();

            Toggl.OnAutotrackerNotification += this.onAutotrackerNotification;
        }
开发者ID:Nukil,项目名称:toggldesktop,代码行数:8,代码来源:AutotrackerNotification.xaml.cs

示例14: InitializeViewLayer

 private void InitializeViewLayer()
 {
     trayIconViewModel = new TrayIconViewModel();
     iconView = (TaskbarIcon)FindResource("NotifyIcon");
     trayIconViewModel.icon = iconView;
     iconView.DataContext = trayIconViewModel;
     mainWindowViewModel = new MainWindowViewModel();
 }
开发者ID:hschroedl,项目名称:clean-folders,代码行数:8,代码来源:App.xaml.cs

示例15: PomodoroNotification

        public PomodoroNotification(TaskbarIcon icon, MainWindow mainWindow)
        {
            this.icon = icon;
            this.mainWindow = mainWindow;
            this.InitializeComponent();

            Toggl.OnDisplayPomodoro += this.onDisplayPomodoro;
        }
开发者ID:DanielJomphe,项目名称:toggldesktop,代码行数:8,代码来源:PomodoroNotification.xaml.cs


注:本文中的Hardcodet.Wpf.TaskbarNotification.TaskbarIcon类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。