本文整理汇总了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);
}
});
}
示例2: CustomBalloon
public CustomBalloon([NotNull] TaskbarIcon taskbarIcon)
{
if (taskbarIcon == null) throw new ArgumentNullException(nameof(taskbarIcon));
InitializeComponent();
_taskbarIcon = taskbarIcon;
}
示例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");
}
示例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();
}
}
示例5: OnStartup
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
ShutdownMode = ShutdownMode.OnExplicitShutdown;
_notificationIcon = (TaskbarIcon)FindResource("NotificationWebViewIcon");
}
示例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;
}
示例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)
};
});
}
示例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");
};
}
示例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();
}
}
示例10: App
public App()
{
InitializeComponent();
tb = (TaskbarIcon)FindResource("iNGenTaskbarIcon");
tb.TrayMouseDoubleClick += tb_TrayMouseDoubleClick;
Locator = new ViewModels.ViewModelLocator();
}
示例11: OnStartup
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
notifyIcon = (TaskbarIcon)FindResource("NotifyIcon");
notifyIcon.ShowBalloonTip("Beba Água", "Beba água iniciado!", BalloonIcon.Info);
}
示例12: InitializeIcon
private void InitializeIcon()
{
_taskbarIcon = (TaskbarIcon) Application.Current.FindResource("NetWatcherNotify");
if (_taskbarIcon != null)
{
_taskbarIcon.DataContext = this;
}
}
示例13: AutotrackerNotification
public AutotrackerNotification(TaskbarIcon icon, MainWindow mainWindow)
{
this.icon = icon;
this.mainWindow = mainWindow;
this.InitializeComponent();
Toggl.OnAutotrackerNotification += this.onAutotrackerNotification;
}
示例14: InitializeViewLayer
private void InitializeViewLayer()
{
trayIconViewModel = new TrayIconViewModel();
iconView = (TaskbarIcon)FindResource("NotifyIcon");
trayIconViewModel.icon = iconView;
iconView.DataContext = trayIconViewModel;
mainWindowViewModel = new MainWindowViewModel();
}
示例15: PomodoroNotification
public PomodoroNotification(TaskbarIcon icon, MainWindow mainWindow)
{
this.icon = icon;
this.mainWindow = mainWindow;
this.InitializeComponent();
Toggl.OnDisplayPomodoro += this.onDisplayPomodoro;
}