public MainWindow() { InitializeComponent(); // Initializing MainWindow this.Title = "Deviant Dock"; this.Width = 450; this.Height = 300; this.Left = SystemParameters.PrimaryScreenWidth - (this.Width + 20); this.Top = SystemParameters.PrimaryScreenHeight - (this.Height + STANDARD_TASKBAR_HEIGHT); this.Topmost = true; this.WindowStyle = WindowStyle.None; try { this.Icon = BitmapFrame.Create(new Uri("Contents/Icon/icon.ico", UriKind.RelativeOrAbsolute)); } catch (Exception) { // Do nothing } GlassEffect.SetIsEnabled(element: this, value: true); // Initialing notifyIconContextMenu notifyIconContextMenu = new System.Windows.Forms.ContextMenu(); // Initialize NotifyIconMenuItems restoreNotifyIconMenuItem = new NotifyIconMenuItem(text: "Restore", contextMenu: ref notifyIconContextMenu); exitNotifyIconMenuItem = new NotifyIconMenuItem(text: "Exit", contextMenu: ref notifyIconContextMenu); notifyIconContextMenu.MenuItems.Add("-"); helpNotifyIconMenuItem = new NotifyIconMenuItem(text: "Help", contextMenu: ref notifyIconContextMenu); contentsNotifyIconMenuItem = new NotifyIconMenuItem(text: "Contents", menuItem: ref helpNotifyIconMenuItem); aboutNotifyIconMenuItem = new NotifyIconMenuItem(text: "About", menuItem: ref helpNotifyIconMenuItem); // Creating the NotifyIcon notifyIcon = new NotifyIcon(); notifyIcon.Text = "Deviant Dock"; // The Text property sets the text that will be displayed, in a tooltip, when the mouse hovers over the systray icon. notifyIcon.ContextMenu = notifyIconContextMenu; // The ContextMenu property sets the menu that will appear when the systray icon is right clicked. try { notifyIcon.Icon = new Icon("Contents/Icon/icon.ico"); // The Icon property sets the icon that will appear in the systray for this application. } catch (Exception) { // Do nothing } Canvas deviantDockMainCanvas = new Canvas(); minimizeImage = new CustomImage(imageName: "Contents/Images/control_button/button_min_regular.png", width: 24, height: 18); closeImage = new CustomImage(imageName: "Contents/Images/control_button/button_close_regular.png", width: 43, height: 18); minimizeImage.Margin = new Thickness((this.Width - (minimizeImage.Width + closeImage.Width + 15)), 0, 0, 0); minimizeImage.ToolTip = "Minimize"; closeImage.Margin = new Thickness(this.Width - (closeImage.Width + 15), 0, 0, 0); closeImage.ToolTip = "Close to system tray"; dockItemListView = new ListView(); dockItemListView.Margin = new Thickness(10, 40, 0, 0); dockItemListView.Width = this.Width - ((2 * 20) - 5); dockItemListView.Height = this.Height - (this.Height / 3); dockItemListView.Opacity = 0.70; dockyListViewItem = new DockListViewItem(title: "Docky", versionNo: "1.0", description: "A simple dock", imageLocation: "Contents/Images/application_image/icon.png"); ringyListViewItem = new DockListViewItem(title: "Ringy", versionNo: "1.0", description: "Circle shaped\ndock", imageLocation: "Contents/Images/application_image/icon.png"); exitButton = new CustomButton(buttonContent: "Exit", width: 65, height: 25, thickness: new Thickness(dockItemListView.Width - 55, dockItemListView.Height + 55, 0, 0)); helpButton = new CustomButton(buttonContent: "Help", width: (int)exitButton.Width, height: (int)exitButton.Height, thickness: new Thickness(dockItemListView.Width - (55 + 5 + exitButton.Width), dockItemListView.Height + 55, 0, 0)); // Adding Contents this.Content = deviantDockMainCanvas; deviantDockMainCanvas.Children.Add(new CustomImage(imageName: "Contents/Images/application_image/icon.png", width: 16, height: 16)); deviantDockMainCanvas.Children.Add(new TextBlock() { Text = this.Title, Margin = new Thickness(16 + 5, 0, 0, 0) }); deviantDockMainCanvas.Children.Add(minimizeImage); deviantDockMainCanvas.Children.Add(closeImage); deviantDockMainCanvas.Children.Add(dockItemListView); dockItemListView.Items.Add(dockyListViewItem); dockItemListView.Items.Add(ringyListViewItem); deviantDockMainCanvas.Children.Add(exitButton); deviantDockMainCanvas.Children.Add(helpButton); // Adding Event Handler this.MouseLeftButtonDown += new MouseButtonEventHandler(MainWindow_MouseLeftButtonDown); restoreNotifyIconMenuItem.Click += new EventHandler(restoreNotifyIconMenuItem_Click); exitNotifyIconMenuItem.Click += new EventHandler(exitNotifyIconMenuItem_Click); minimizeImage.MouseLeftButtonDown += new MouseButtonEventHandler(minimizeImage_MouseLeftButtonDown); closeImage.MouseLeftButtonDown += new MouseButtonEventHandler(closeImage_MouseLeftButtonDown); dockyListViewItem.addButton.Click += new RoutedEventHandler(dockyListViewItem_addButton_Click); dockyListViewItem.removeButton.Click += new RoutedEventHandler(dockyListViewItem_removeButton_Click); ringyListViewItem.addButton.Click += new RoutedEventHandler(ringyListViewItem_addButton_Click); ringyListViewItem.removeButton.Click += new RoutedEventHandler(ringyListViewItem_removeButton_Click); exitButton.Click += new RoutedEventHandler(exitButton_Click); helpButton.Click += new RoutedEventHandler(helpButton_Click); contentsNotifyIconMenuItem.Click += new EventHandler(contentsNotifyIconMenuItem_Click); aboutNotifyIconMenuItem.Click += new EventHandler(aboutNotifyIconMenuItem_Click); // Initializing Application Settings closeToSystemTray(); if (!File.Exists(path: settingsPath + "PrimarySettings.dds")) { createNewPrimarySettings(); } loadPrimarySettings(); loadDocky(); loadRingy(); }
public DockyOptionsWindow() { this.Width = 6 * 64; this.Height = 5 * 64; this.ResizeMode = ResizeMode.NoResize; this.ShowInTaskbar = false; this.Title = "Docky Options"; this.Topmost = true; this.WindowStyle = WindowStyle.ToolWindow; this.WindowStartupLocation = WindowStartupLocation.CenterScreen; this.Visibility = Visibility.Visible; GlassEffect.SetIsEnabled(element: this, value: true); Canvas mainCanvas = new Canvas(); TabControl categoryTabControl = new TabControl(); categoryTabControl.Width = this.Width - (this.Width / (this.Width / 6)); categoryTabControl.Height = this.Height - (this.Height / 5); positionDockyOptionsTabItem = new DockyOptionsTabItem(title: "Position", iconLocation: "Icons/Toolbar Icon/step.png", tabControl: ref categoryTabControl); styleDockyOptionsTabItem = new DockyOptionsTabItem(title: "Style", iconLocation: "Icons/Toolbar Icon/style.png", tabControl: ref categoryTabControl); aboutDockyOptionsTabItem = new DockyOptionsTabItem(title: "About", iconLocation: "Icons/Toolbar Icon/info.png", tabControl: ref categoryTabControl); Canvas positionDockyOptionsCanvas = new Canvas(); positionDockyOptionsCanvas.Background = new LinearGradientBrush(startColor: Colors.White, endColor: Color.FromRgb(r: 235, g: 235, b: 235), angle: -45); CustomLabel screenPositionLabel = new CustomLabel(text: "Screen Positions:", thickness: new Thickness(uniformLength: 10)); CustomLabel layeringLabel = new CustomLabel(text: "Layering:", thickness: new Thickness(left: ((Thickness)screenPositionLabel.Margin).Left, top: ((Thickness)screenPositionLabel.Margin).Top + (1 * 30), right: 0, bottom: 0)); CustomLabel centeringLabel = new CustomLabel(text: "Centering:", thickness: new Thickness(left: ((Thickness)layeringLabel.Margin).Left, top: ((Thickness)layeringLabel.Margin).Top + (2 * 30), right: 0, bottom: 0)); CustomLabel edgeOffsetLabel = new CustomLabel(text: "Edge Offset:", thickness: new Thickness(left: ((Thickness)centeringLabel.Margin).Left, top: ((Thickness)centeringLabel.Margin).Top + (1 * 30), right: 0, bottom: 0)); screenPositionComboBox = new CustomComboBox(items: screenPositions, width: STANDARD_WIDTH * 2, thickness: new Thickness(left: ((Thickness)screenPositionLabel.Margin).Left + 120, top: ((Thickness)screenPositionLabel.Margin).Top + 3, right: 0, bottom: 0)); layeringComboBox = new CustomComboBox(items: layering, width: (int)screenPositionComboBox.Width, thickness: new Thickness(left: ((Thickness)screenPositionComboBox.Margin).Left, top: ((Thickness)layeringLabel.Margin).Top + 3, right: 0, bottom: 0)); centeringSlider = new CustomSlider(width: STANDARD_WIDTH * 3, startValue: -100, endValue: 100, thickness: new Thickness(left: ((Thickness)layeringComboBox.Margin).Left - 5, top: ((Thickness)centeringLabel.Margin).Top, right: 0, bottom: 0)); edgeOffsetSlider = new CustomSlider(width: (int)centeringSlider.Width, startValue: -15, endValue: 128, thickness: new Thickness(left: ((Thickness)layeringComboBox.Margin).Left - 5, top: ((Thickness)edgeOffsetLabel.Margin).Top, right: 0, bottom: 0)); Canvas styleDockyOptionsCanvas = new Canvas(); styleDockyOptionsCanvas.Background = new LinearGradientBrush(startColor: Colors.White, endColor: Color.FromRgb(r: 235, g: 235, b: 235), angle: -45); CustomLabel themeLabel = new CustomLabel(text: "Theme:", thickness: new Thickness(uniformLength: 10)); CustomLabel hoaverEffectLabel = new CustomLabel(text: "Hoaver Effect:", thickness: new Thickness(left: ((Thickness)themeLabel.Margin).Left, top: ((Thickness)themeLabel.Margin).Top + (1 * 30), right: 0, bottom: 0)); CustomLabel clickEffectLabel = new CustomLabel(text: "Click Effect:", thickness: new Thickness(left: ((Thickness)hoaverEffectLabel.Margin).Left, top: ((Thickness)hoaverEffectLabel.Margin).Top + 30, right: 0, bottom: 0)); themeComboBox = new CustomComboBox(items: getThemeName(themeDirectories: Directory.GetDirectories(Directory.GetCurrentDirectory() + @"\Skins")), width: STANDARD_WIDTH * 2, thickness: new Thickness(left: ((Thickness)themeLabel.Margin).Left + 120, top: ((Thickness)themeLabel.Margin).Top + 3, right: 0, bottom: 0)); hoaverEffectComboBox = new CustomComboBox(items: animationEffects, width: STANDARD_WIDTH * 2, thickness: new Thickness(left: ((Thickness)themeComboBox.Margin).Left, top: ((Thickness)hoaverEffectLabel.Margin).Top + 3, right: 0, bottom: 0)); clickEffectComboBox = new CustomComboBox(items: animationEffects, width: STANDARD_WIDTH * 2, thickness: new Thickness(left: ((Thickness)hoaverEffectComboBox.Margin).Left, top: ((Thickness)clickEffectLabel.Margin).Top + 3, right: 0, bottom: 0)); showIconLabelCheckBox = new CheckBox(); showIconLabelCheckBox.Content = "Show Icon Label"; showIconLabelCheckBox.Margin = new Thickness(left: ((Thickness)clickEffectLabel.Margin).Left, top: ((Thickness)clickEffectLabel.Margin).Top + (3 * 30), right: 0, bottom: 0); helpButton = new CustomButton(buttonContent: "Help", width: STANDARD_WIDTH, height: STANDARD_BUTTON_HEIGHT, thickness: new Thickness(left: 0, top: this.Height - (2 * STANDARD_BUTTON_HEIGHT), right: 0, bottom: 0)); defaultButton = new CustomButton(buttonContent: "Default", width: STANDARD_WIDTH, height: STANDARD_BUTTON_HEIGHT, thickness: new Thickness(left: this.Width - (2 * STANDARD_WIDTH) - (2 * STANDARD_BUTTON_SEPARATOR), top: ((Thickness)helpButton.Margin).Top, right: 0, bottom: 0)); closeButton = new CustomButton(buttonContent: "Close", width: STANDARD_WIDTH, height: STANDARD_BUTTON_HEIGHT, thickness: new Thickness(left: this.Width - (1 * STANDARD_WIDTH) - (1 * STANDARD_BUTTON_SEPARATOR), top: ((Thickness)defaultButton.Margin).Top, right: 0, bottom: 0)); // Adding contents this.Content = mainCanvas; mainCanvas.Children.Add(categoryTabControl); mainCanvas.Children.Add(helpButton); mainCanvas.Children.Add(defaultButton); mainCanvas.Children.Add(closeButton); positionDockyOptionsTabItem.Content = positionDockyOptionsCanvas; positionDockyOptionsCanvas.Children.Add(screenPositionLabel); positionDockyOptionsCanvas.Children.Add(screenPositionComboBox); positionDockyOptionsCanvas.Children.Add(layeringLabel); positionDockyOptionsCanvas.Children.Add(layeringComboBox); positionDockyOptionsCanvas.Children.Add(centeringLabel); positionDockyOptionsCanvas.Children.Add(centeringSlider); positionDockyOptionsCanvas.Children.Add(edgeOffsetLabel); positionDockyOptionsCanvas.Children.Add(edgeOffsetSlider); styleDockyOptionsTabItem.Content = styleDockyOptionsCanvas; styleDockyOptionsCanvas.Children.Add(themeLabel); styleDockyOptionsCanvas.Children.Add(themeComboBox); styleDockyOptionsCanvas.Children.Add(hoaverEffectLabel); styleDockyOptionsCanvas.Children.Add(hoaverEffectComboBox); styleDockyOptionsCanvas.Children.Add(clickEffectLabel); styleDockyOptionsCanvas.Children.Add(clickEffectComboBox); styleDockyOptionsCanvas.Children.Add(showIconLabelCheckBox); aboutDockyOptionsTabItem.Content = new AboutStackPanel(); // Adding Event Handler this.MouseLeftButtonDown += new MouseButtonEventHandler(DockyOptionsWindow_MouseLeftButtonDown); helpButton.Click += new RoutedEventHandler(helpButton_Click); closeButton.Click += new RoutedEventHandler(closeButton_Click); }
public RingyOptionsWindow(ref List <IconSettings> ringyIconSettings, string logoImageLocation) { this.Width = 4 * 64; this.Height = 8 * 64; this.ShowInTaskbar = false; this.Title = "Ringy Options"; this.Topmost = true; this.ResizeMode = ResizeMode.NoResize; this.WindowStyle = WindowStyle.ToolWindow; this.Visibility = Visibility.Visible; this.Left = STANDARD_SEPARATOR_DISTANCE * 10; this.Top = this.Left; GlassEffect.SetIsEnabled(element: this, value: true); Canvas baseCanvas = new Canvas(); Canvas ringyOptionsCanvas = new Canvas(); ringyOptionsCanvas.Background = new LinearGradientBrush(startColor: Colors.White, endColor: Color.FromRgb(r: 221, g: 231, b: 244), angle: -30); ringyOptionsCanvas.Width = this.Width; ringyOptionsCanvas.Height = this.Height - ((this.Height) / 9); ringyOptionsCanvas.Margin = new Thickness(uniformLength: 0); generalGroupBox = new CustomGroupBox(title: "General", width: (int)ringyOptionsCanvas.Width - (STANDARD_SEPARATOR_DISTANCE * 3), height: (int)ringyOptionsCanvas.Height / 4 - (STANDARD_SEPARATOR_DISTANCE * 0), thickness: new Thickness(uniformLength: STANDARD_SEPARATOR_DISTANCE), baseCanvas: ref ringyOptionsCanvas); iconSettingsGroupBox = new CustomGroupBox(title: "Icon Settings", width: (int)generalGroupBox.Width, height: (int)(ringyOptionsCanvas.Height - generalGroupBox.Height - (STANDARD_SEPARATOR_DISTANCE * 14)), thickness: new Thickness(left: ((Thickness)generalGroupBox.Margin).Left, top: ((Thickness)generalGroupBox.Margin).Top + generalGroupBox.Height + (STANDARD_SEPARATOR_DISTANCE * 1), right: 0, bottom: 0), baseCanvas: ref ringyOptionsCanvas); logoImageGroupBox = new CustomGroupBox(title: "Logo Image", width: (int)iconSettingsGroupBox.Width, height: (int)(this.Height - generalGroupBox.Height - iconSettingsGroupBox.Height - (STANDARD_SEPARATOR_DISTANCE * 6)) / 2, thickness: new Thickness(left: ((Thickness)iconSettingsGroupBox.Margin).Left, top: ((Thickness)iconSettingsGroupBox.Margin).Top + iconSettingsGroupBox.Height + (STANDARD_SEPARATOR_DISTANCE * 1), right: 0, bottom: 0), baseCanvas: ref ringyOptionsCanvas); generalCanvas = new Canvas(); CustomLabel themeLabel = new CustomLabel(text: "Theme:", thickness: new Thickness(uniformLength: STANDARD_SEPARATOR_DISTANCE * 1)); CustomLabel animationEffectLabel = new CustomLabel(text: "Animation Effect:", thickness: new Thickness(left: ((Thickness)themeLabel.Margin).Left, top: ((Thickness)themeLabel.Margin).Top + (STANDARD_SEPARATOR_DISTANCE * 6), right: 0, bottom: 0)); themeComboBox = new CustomComboBox(items: getThemeName(themeLocation: Directory.GetFiles(path: "Background")), width: (int)(STANDARD_WIDTH * 1.5), thickness: new Thickness(left: STANDARD_WIDTH * 1.7, top: ((Thickness)themeLabel.Margin).Top, right: 0, bottom: 0)); animationEffectComboBox = new CustomComboBox(items: new [] { "Zoom", "Fade", "Rotate" }, width: (int)themeComboBox.Width, thickness: new Thickness(left: ((Thickness)themeComboBox.Margin).Left, top: ((Thickness)animationEffectLabel.Margin).Top, right: 0, bottom: 0)); showIconLabelCheckBox = new CheckBox(); showIconLabelCheckBox.Content = "Show Icon Label"; showIconLabelCheckBox.Margin = new Thickness(left: ((Thickness)animationEffectLabel.Margin).Left + STANDARD_SEPARATOR_DISTANCE, top: ((Thickness)animationEffectLabel.Margin).Top + (STANDARD_SEPARATOR_DISTANCE * 7), right: 0, bottom: 0); helpButton = new CustomButton(buttonContent: "Help", width: STANDARD_WIDTH, height: STANDARD_BUTTON_HEIGHT, thickness: new Thickness(left: 0, top: ringyOptionsCanvas.Height + (STANDARD_SEPARATOR_DISTANCE * 1), right: 0, bottom: 0)); closeButton = new CustomButton(buttonContent: "Close", width: (int)helpButton.Width, height: (int)helpButton.Height, thickness: new Thickness(left: this.Width - helpButton.Width - (STANDARD_SEPARATOR_DISTANCE * 1) - 1, top: ((Thickness)helpButton.Margin).Top, right: 0, bottom: 0)); defaultButton = new CustomButton(buttonContent: "Default", width: (int)closeButton.Width, height: (int)closeButton.Height, thickness: new Thickness(left: ((Thickness)closeButton.Margin).Left - closeButton.Width - STANDARD_SEPARATOR_DISTANCE, top: ((Thickness)closeButton.Margin).Top, right: 0, bottom: 0)); iconSettingsCanvas = new Canvas(); logoImageCanvas = new Canvas(); // Adding Contents this.Content = baseCanvas; baseCanvas.Children.Add(ringyOptionsCanvas); generalGroupBox.Content = generalCanvas; generalCanvas.Children.Add(themeLabel); generalCanvas.Children.Add(themeComboBox); generalCanvas.Children.Add(animationEffectLabel); generalCanvas.Children.Add(animationEffectComboBox); generalCanvas.Children.Add(showIconLabelCheckBox); iconSettingsGroupBox.Content = iconSettingsCanvas; logoImageGroupBox.Content = logoImageCanvas; baseCanvas.Children.Add(helpButton); baseCanvas.Children.Add(closeButton); baseCanvas.Children.Add(defaultButton); // Addings Event Handler helpButton.Click += new RoutedEventHandler(helpButton_Click); closeButton.Click += new RoutedEventHandler(closeButton_Click); setLogoImageComponents(logoImageLocation); }