Exemple #1
0
 private void searchcheck_Tick(object sender, EventArgs e)
 {
     if (WindowsServices.QueryStatus("WSearch") == ServiceStatus.Running)
     {
         setSearchProvider();
         CairoSearchMenu.Visibility = Visibility.Visible;
         (sender as DispatcherTimer).Stop();
     }
     else
     {
         CairoSearchMenu.Visibility = Visibility.Collapsed;
     }
 }
Exemple #2
0
        private void setupSearch()
        {
            this.CommandBindings.Add(new CommandBinding(CustomCommands.OpenSearchResult, ExecuteOpenSearchResult));

            // Show the search button only if the service is running
            if (WindowsServices.QueryStatus("WSearch") == ServiceStatus.Running)
            {
                setSearchProvider();
            }
            else
            {
                CairoSearchMenu.Visibility = Visibility.Collapsed;
                DispatcherTimer searchcheck = new DispatcherTimer(DispatcherPriority.Background, this.Dispatcher);
                searchcheck.Interval = new TimeSpan(0, 0, 5);
                searchcheck.Tick    += searchcheck_Tick;
                searchcheck.Start();
            }
        }
Exemple #3
0
        public MenuBar()
        {
            this.DataContext = this;
            TaskBarItems     = new ObservableCollection <TaskBarItem>();
            this.InitializeComponent();

            WindowsTasksService.WindowsChanged += WindowsTasksService_WindowsChanged;
            BuildTaskBarItems();

            // Show the search button only if the service is running
            if (WindowsServices.QueryStatus("WSearch") == ServiceStatus.Running)
            {
                ObjectDataProvider vistaSearchProvider = new ObjectDataProvider();
                vistaSearchProvider.ObjectType = typeof(VistaSearchProvider.VistaSearchProviderHelper);
                CairoSearchMenu.DataContext    = vistaSearchProvider;
            }
            else
            {
                CairoSearchMenu.Visibility = Visibility.Collapsed;
                DispatcherTimer searchcheck = new DispatcherTimer(new TimeSpan(0, 0, 7), DispatcherPriority.Normal, delegate
                {
                    if (WindowsServices.QueryStatus("WSearch") == ServiceStatus.Running)
                    {
                        ObjectDataProvider vistaSearchProvider = new ObjectDataProvider();
                        vistaSearchProvider.ObjectType         = typeof(VistaSearchProvider.VistaSearchProviderHelper);
                        CairoSearchMenu.DataContext            = vistaSearchProvider;
                        CairoSearchMenu.Visibility             = Visibility.Visible;
                    }
                    else
                    {
                        CairoSearchMenu.Visibility = Visibility.Collapsed;
                    }
                }, this.Dispatcher);
            }
            // ---------------------------------------------------------------- //

            InitializeClock();
        }
Exemple #4
0
        public MenuBar()
        {
            this.InitializeComponent();
            // Sets the Theme for Cairo
            string theme = Properties.Settings.Default.CairoTheme;

            if (theme != "Cairo.xaml")
            {
                ResourceDictionary CairoDictionary = (ResourceDictionary)XamlReader.Load(System.Xml.XmlReader.Create(AppDomain.CurrentDomain.BaseDirectory + theme));
                this.Resources.MergedDictionaries[0] = CairoDictionary;
            }
            if (Properties.Settings.Default.UseDarkIcons)
            {
                SolidColorBrush borderBrushColor = new SolidColorBrush();
                borderBrushColor.Color = Color.FromArgb(135, 0, 0, 0);
                this.BorderBrush       = borderBrushColor;
                this.BorderThickness   = new Thickness(0, 0, 0, 0);
                this.Height            = 22;
                this.MaxHeight         = 22;
                this.Background        = Brushes.Transparent;
                BitmapImage CairoMenuIconBlack = new BitmapImage();
                CairoMenuIconBlack.BeginInit();
                CairoMenuIconBlack.UriSource = new Uri("pack://application:,,,/Resources/cairoMenuBlack.png", UriKind.RelativeOrAbsolute);
                CairoMenuIconBlack.EndInit();
                CairoMenuIcon.Source = CairoMenuIconBlack;
                BitmapImage CairoSearchMenuIconBlack = new BitmapImage();
                CairoSearchMenuIconBlack.BeginInit();
                CairoSearchMenuIconBlack.UriSource = new Uri("pack://application:,,,/Resources/searchBlack.png", UriKind.RelativeOrAbsolute);
                CairoSearchMenuIconBlack.EndInit();
                CairoSearchMenuIcon.Source = CairoSearchMenuIconBlack;
            }

            this.CommandBindings.Add(new CommandBinding(CustomCommands.OpenSearchResult, ExecuteOpenSearchResult));

            // Show the search button only if the service is running
            if (WindowsServices.QueryStatus("WSearch") == ServiceStatus.Running)
            {
                ObjectDataProvider vistaSearchProvider = new ObjectDataProvider();
                vistaSearchProvider.ObjectType = typeof(VistaSearchProvider.VistaSearchProviderHelper);
                CairoSearchMenu.DataContext    = vistaSearchProvider;
            }
            else
            {
                CairoSearchMenu.Visibility = Visibility.Collapsed;
                DispatcherTimer searchcheck = new DispatcherTimer(new TimeSpan(0, 0, 7), DispatcherPriority.Normal, delegate
                {
                    if (WindowsServices.QueryStatus("WSearch") == ServiceStatus.Running)
                    {
                        ObjectDataProvider vistaSearchProvider = new ObjectDataProvider();
                        vistaSearchProvider.ObjectType         = typeof(VistaSearchProvider.VistaSearchProviderHelper);
                        CairoSearchMenu.DataContext            = vistaSearchProvider;
                        CairoSearchMenu.Visibility             = Visibility.Visible;
                    }
                    else
                    {
                        CairoSearchMenu.Visibility = Visibility.Collapsed;
                    }
                }, this.Dispatcher);
            }
            if (System.Environment.OSVersion.Version.Major < 6)
            {
                PlacesDownloadsItem.Visibility = Visibility.Collapsed;
            }
            // ---------------------------------------------------------------- //

            InitializeClock();

            //Set Quick Launch category to not show in menu
            AppGrabber.Category ql = appGrabber.CategoryList.GetCategory("Quick Launch");
            if (ql != null)
            {
                ql.ShowInMenu = false;
            }

            //Set Programs Menu to use appGrabber's ProgramList as its source
            categorizedProgramsList.ItemsSource = appGrabber.CategoryList;
        }