예제 #1
0
        private void _dispatcherTimer_Tick(object sender, EventArgs e)
        {
            _dispatcherTimer.Stop();

            var latestStatuses = _statusProvider.GetStatusList(_uriList);

            foreach (var newStatus in latestStatuses)
            {
                var oldStatus = _buildStatuses.Single(b => b.Key == newStatus.Key);
                if (newStatus.BuildId != oldStatus.BuildId)
                {
                    var title = newStatus.BuildName;
                    _taskbarIcon.ShowBalloonTip(title, MenuItemHelper.BuildBallonBody(newStatus), ResourceHelper.GetIcon(newStatus), true);

                    foreach (var contextMenuItem in _contextMenu.Items)
                    {
                        var menuItem = contextMenuItem as MenuItem;
                        var tag      = menuItem?.Tag as Uri;
                        if (tag == null || tag != oldStatus.Key)
                        {
                            continue;
                        }
                        MenuItemHelper.ConfigureMenuItem(menuItem, newStatus);
                    }
                }
                oldStatus.Status      = newStatus.Status;
                oldStatus.BuildId     = newStatus.BuildId;
                oldStatus.RequestedBy = newStatus.RequestedBy;
            }
            _dispatcherTimer.Start();
        }
예제 #2
0
        private void BuildStandardMenuItems()
        {
            var exitItem = new MenuItem {
                Header = "Exit"
            };

            exitItem.Click += ExitItem_Click;

            var launchItem = new MenuItem
            {
                Header      = "Launch at Startup",
                IsCheckable = true,
                IsChecked   = MenuItemHelper.GetStartupStatus()
            };

            MenuItemHelper.SetStartup(launchItem.IsChecked);
            launchItem.Click += LaunchItem_Click;

            if (MenuItemHelper.CheckVersion())
            {
                var newVersionItem = new MenuItem
                {
                    Header = "Update available!",
                    Icon   = MenuItemHelper.GetImageFromResource(
                        "pack://application:,,,/Resources/StatusWarning_256x.png")
                };
                newVersionItem.Click += NewVersionItem_Click;
                _contextMenu.Items.Add(newVersionItem);
            }

            _contextMenu.Items.Add(launchItem);
            _contextMenu.Items.Add(exitItem);
        }
예제 #3
0
 private void AddMenuItems(List <Uri> uriList)
 {
     _buildStatuses = _statusProvider.GetStatusList(uriList);
     foreach (var buildStatus in _buildStatuses)
     {
         var item = new MenuItem();
         MenuItemHelper.ConfigureMenuItem(item, buildStatus);
         item.Click += ItemOnClick;
         _contextMenu.Items.Insert(0, item);
     }
 }
예제 #4
0
        private void LaunchItem_Click(object sender, RoutedEventArgs e)
        {
            var menuItem = sender as MenuItem;

            MenuItemHelper.SetStartup(menuItem != null && menuItem.IsChecked);
        }
예제 #5
0
 private void NewVersionItem_Click(object sender, RoutedEventArgs e)
 {
     MenuItemHelper.LaunchUpdateUrl();
 }
예제 #6
0
 private void ItemOnClick(object sender, RoutedEventArgs e)
 {
     MenuItemHelper.LaunchUrl(sender as MenuItem, _buildStatuses);
 }