private void setupPrograms() { if (Environment.OSVersion.Version.Major >= 10) { // show Windows 10 features miOpenUWPSettings.Visibility = Visibility.Visible; //meOpenActionCenter.Visibility = Visibility.Visible; // need to make icon for this } // Set Quick Launch and Uncategorized categories to not show in menu AppGrabber.Category ql = appGrabber.CategoryList.GetCategory("Quick Launch"); if (ql != null) { ql.ShowInMenu = false; } AppGrabber.Category uncat = appGrabber.CategoryList.GetCategory("Uncategorized"); if (uncat != null) { uncat.ShowInMenu = false; } // Set Programs Menu to use appGrabber's ProgramList as its source categorizedProgramsList.ItemsSource = appGrabber.CategoryList; // set tab based on user preference int i = categorizedProgramsList.Items.IndexOf(appGrabber.CategoryList.GetCategory(Settings.DefaultProgramsCategory)); categorizedProgramsList.SelectedIndex = i; }
private void setupTaskbar() { AppGrabber.Category quickLaunch = appGrabber.QuickLaunch; this.quickLaunchList.ItemsSource = quickLaunch; this.bdrTaskbar.MaxWidth = AppBarHelper.PrimaryMonitorSize.Width - 36; this.Width = AppBarHelper.PrimaryMonitorSize.Width; // set taskbar edge based on preference if (Settings.TaskbarPosition == 1) { this.Top = Startup.MenuBarWindow.Height; appBarEdge = AppBarHelper.ABEdge.ABE_TOP; bdrTaskbar.Style = Application.Current.FindResource("CairoTaskbarTopBorderStyle") as Style; bdrTaskbarEnd.Style = Application.Current.FindResource("CairoTaskbarEndTopBorderStyle") as Style; bdrTaskListPopup.Style = Application.Current.FindResource("CairoTaskListTopPopupStyle") as Style; btnTaskList.Style = Application.Current.FindResource("CairoTaskbarTopButtonList") as Style; TasksList.Margin = new Thickness(0); } else { int screen = AppBarHelper.PrimaryMonitorSize.Height; setTopPosition(screen, true); } // show task view on windows >= 10, adjust margin if not shown if (Shell.IsWindows10OrBetter && !Startup.IsCairoUserShell) { bdrTaskView.Visibility = Visibility.Visible; } else { TasksList2.Margin = new Thickness(0, -3, 0, -3); } }
private void setupTaskbar() { AppGrabber.Category quickLaunch = appGrabber.QuickLaunch; this.quickLaunchList.ItemsSource = quickLaunch; this.TaskbarBorder.MaxWidth = AppBarHelper.PrimaryMonitorSize.Width - 36; this.Width = AppBarHelper.PrimaryMonitorSize.Width; }
private void setupPrograms() { // Set Quick Launch and Uncategorized categories to not show in menu AppGrabber.Category ql = appGrabber.CategoryList.GetCategory("Quick Launch"); if (ql != null) { ql.ShowInMenu = false; } AppGrabber.Category uncat = appGrabber.CategoryList.GetCategory("Uncategorized"); if (uncat != null) { uncat.ShowInMenu = false; } // Set Programs Menu to use appGrabber's ProgramList as its source categorizedProgramsList.ItemsSource = appGrabber.CategoryList; // set tab based on user preference int i = categorizedProgramsList.Items.IndexOf(appGrabber.CategoryList.GetCategory(Settings.DefaultProgramsCategory)); categorizedProgramsList.SelectedIndex = i; }
private void setupTaskbar() { double screenWidth = screenWidth = Screen.Bounds.Width / dpiScale; Left = Screen.Bounds.Left / dpiScale; this.DataContext = WindowsTasks.WindowsTasksService.Instance; bdrMain.DataContext = Settings.Instance; grdTaskbar.DataContext = WindowsTasks.WindowsTasksService.Instance; AppGrabber.Category quickLaunch = appGrabber.QuickLaunch; this.quickLaunchList.ItemsSource = quickLaunch; this.bdrTaskbar.MaxWidth = screenWidth - 36; this.Width = screenWidth; switch (Settings.TaskbarIconSize) { case 0: addToSize = 16; break; case 10: addToSize = 8; break; default: addToSize = 0; break; } this.Height = 29 + addToSize; ((INotifyCollectionChanged)TasksList.Items).CollectionChanged += TasksList_Changed; if (Startup.DesktopWindow != null) { btnDesktopOverlay.DataContext = Startup.DesktopWindow; } else { btnDesktopOverlay.Visibility = Visibility.Collapsed; } // set taskbar edge based on preference if (Settings.TaskbarPosition == 1) { this.Top = Startup.MenuBarWindow.Height; appBarEdge = AppBarHelper.ABEdge.ABE_TOP; bdrTaskbar.Style = Application.Current.FindResource("CairoTaskbarTopBorderStyle") as Style; bdrTaskbarEnd.Style = Application.Current.FindResource("CairoTaskbarEndTopBorderStyle") as Style; bdrTaskbarLeft.Style = Application.Current.FindResource("CairoTaskbarLeftTopBorderStyle") as Style; btnTaskList.Style = Application.Current.FindResource("CairoTaskbarTopButtonList") as Style; btnDesktopOverlay.Style = Application.Current.FindResource("CairoTaskbarTopButtonDesktopOverlay") as Style; TaskbarGroupStyle.ContainerStyle = Application.Current.FindResource("CairoTaskbarTopGroupStyle") as Style; TasksList.Margin = new Thickness(0); bdrTaskListPopup.Margin = new Thickness(5, this.Top + this.Height - 1, 5, 11); } else { bdrTaskListPopup.Margin = new Thickness(5, 0, 5, this.Height - 1); setTopPosition(Screen.Bounds.Bottom / dpiScale); } // show task view on windows >= 10, adjust margin if not shown if (Shell.IsWindows10OrBetter && !Startup.IsCairoUserShell) { bdrTaskView.Visibility = Visibility.Visible; } else { TasksList2.Margin = new Thickness(0, -3, 0, -3); } }
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; }
private void ListView_Drop(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(typeof(ApplicationInfo))) { CairoLogger.Instance.Debug(e.Data.GetData(typeof(ApplicationInfo)).ToString()); ApplicationInfo dropData = e.Data.GetData(typeof(ApplicationInfo)) as ApplicationInfo; ListView dropTarget = sender as ListView; if (dropTarget.ItemsSource is Category) { Category target = dropTarget.ItemsSource as Category; if (target.Type == 3) { e.Effects = DragDropEffects.Copy; // Do not duplicate entries if (!target.Contains(dropData)) { ApplicationInfo dropClone = dropData.Clone(); if (e.OriginalSource != null && e.OriginalSource is FrameworkElement && (e.OriginalSource as FrameworkElement).DataContext != null && (e.OriginalSource as FrameworkElement).DataContext is ApplicationInfo) target.Insert(target.IndexOf((e.OriginalSource as FrameworkElement).DataContext as ApplicationInfo), dropClone); else target.Add(dropClone); dropClone.Icon = null; // icon may differ depending on category dropClone.IconPath = null; } else { // reorder existing if (e.OriginalSource != null && e.OriginalSource is FrameworkElement && (e.OriginalSource as FrameworkElement).DataContext != null && (e.OriginalSource as FrameworkElement).DataContext is ApplicationInfo) target.Move(target.IndexOf(dropData), target.IndexOf((e.OriginalSource as FrameworkElement).DataContext as ApplicationInfo)); } } else if (sourceView != null && sourceView != sender) { e.Effects = DragDropEffects.Move; Category source = sourceView.ItemsSource as Category; source.Remove(dropData); if (source.Type != 3) { target.Add(dropData); // if coming from quick launch, simply remove from quick launch } } } else { e.Effects = DragDropEffects.Move; (sourceView.ItemsSource as IList<ApplicationInfo>).Remove(dropData); (dropTarget.ItemsSource as IList<ApplicationInfo>).Add(dropData); } } else if (e.Data.GetDataPresent(DataFormats.FileDrop)) { string[] fileNames = e.Data.GetData(DataFormats.FileDrop) as string[]; if (fileNames != null) { ListView dropTarget = sender as ListView; if (!(dropTarget.ItemsSource is Category)) { foreach (String fileName in fileNames) { CairoLogger.Instance.Debug(fileName); if (Shell.Exists(fileName)) { ApplicationInfo customApp = AppGrabber.PathToApp(fileName, false); if (!object.ReferenceEquals(customApp, null)) { (dropTarget.ItemsSource as IList<ApplicationInfo>).Add(customApp); if (dropTarget.Items.Contains(customApp)) { dropTarget.ScrollIntoView(dropTarget.Items[dropTarget.Items.IndexOf(customApp)]); } } } } } } } sourceView = null; isDragging = false; }