コード例 #1
0
        public DockyIconSettingsWindow()
        {
            this.Width                 = 5 * 64;
            this.Height                = 6 * 64;
            this.Title                 = "Icon Settings";
            this.ResizeMode            = ResizeMode.NoResize;
            this.ShowInTaskbar         = false;
            this.WindowStyle           = WindowStyle.ToolWindow;
            this.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            this.Visibility            = Visibility.Visible;

            Canvas canvas = new Canvas();

            canvas.Background = new LinearGradientBrush(startColor: Colors.White, endColor: Color.FromRgb(r: 221, g: 231, b: 244), angle: -45);

            iconsListView               = new ListView();
            iconsListView.Width         = this.Width - (8 * (2 * STANDARD_SEPARATOR_DISTANCE)) - STANDARD_BUTTON_WIDTH;
            iconsListView.Height        = this.Height - (5 * (2 * STANDARD_SEPARATOR_DISTANCE) - STANDARD_SEPARATOR_DISTANCE);
            iconsListView.SelectionMode = SelectionMode.Single;
            iconsListView.Margin        = new Thickness(uniformLength: 2 * STANDARD_SEPARATOR_DISTANCE);

            CustomGroupBox addIconGroupBox = new CustomGroupBox(title: "Add Icon", width: (int)(this.Width - iconsListView.Width - 4 * (2 * STANDARD_SEPARATOR_DISTANCE)), height: (int)(this.Height / 3 + (2 * STANDARD_SEPARATOR_DISTANCE)), thickness: new Thickness(left: ((Thickness)iconsListView.Margin).Left + iconsListView.Width + (2.5 * STANDARD_SEPARATOR_DISTANCE), top: ((Thickness)iconsListView.Margin).Top, right: 0, bottom: 0), baseCanvas: ref canvas);

            addFileButton      = new CustomButton(buttonContent: "Add File", width: STANDARD_BUTTON_WIDTH, height: STANDARD_BUTTON_HEIGHT, thickness: new Thickness(left: (3 * STANDARD_SEPARATOR_DISTANCE), top: (2 * STANDARD_SEPARATOR_DISTANCE), right: 0, bottom: 0));
            addPathButton      = new CustomButton(buttonContent: "Add Path", width: STANDARD_BUTTON_WIDTH, height: STANDARD_BUTTON_HEIGHT, thickness: new Thickness(left: ((Thickness)addFileButton.Margin).Left, top: ((Thickness)addFileButton.Margin).Top + addFileButton.Height + (2 * STANDARD_SEPARATOR_DISTANCE), right: 0, bottom: 0));
            addSeparatorButton = new CustomButton(buttonContent: "Separator", width: STANDARD_BUTTON_WIDTH, height: STANDARD_BUTTON_HEIGHT, thickness: new Thickness(left: ((Thickness)addPathButton.Margin).Left, top: ((Thickness)addPathButton.Margin).Top + addPathButton.Height + (2 * STANDARD_SEPARATOR_DISTANCE), right: 0, bottom: 0));

            CustomGroupBox organizeIconGroupBox = new CustomGroupBox(title: "Organize", width: (int)addIconGroupBox.Width, height: (int)(this.Height - this.Height / 3 - (this.Height / 3 - addIconGroupBox.Height) - (16 * STANDARD_SEPARATOR_DISTANCE)), thickness: new Thickness(left: ((Thickness)addIconGroupBox.Margin).Left, top: ((Thickness)addIconGroupBox.Margin).Top + addIconGroupBox.Height + (3 * STANDARD_SEPARATOR_DISTANCE), right: 0, bottom: 0), baseCanvas: ref canvas);

            editButton     = new CustomButton(buttonContent: "Edit", width: STANDARD_BUTTON_WIDTH, height: STANDARD_BUTTON_HEIGHT, thickness: new Thickness(left: ((Thickness)addFileButton.Margin).Left, top: ((Thickness)addFileButton.Margin).Top, right: 0, bottom: 0));
            removeButton   = new CustomButton(buttonContent: "Remove", width: STANDARD_BUTTON_WIDTH, height: STANDARD_BUTTON_HEIGHT, thickness: new Thickness(left: ((Thickness)editButton.Margin).Left, top: ((Thickness)editButton.Margin).Top + editButton.Height + (2 * STANDARD_SEPARATOR_DISTANCE), right: 0, bottom: 0));
            moveUpButton   = new CustomButton(imageIcon: new CustomImage(imageName: "Icons/Toolbar Icon/go-up.png", width: STANDARD_SMALL_ICON_DIMENSION, height: STANDARD_SMALL_ICON_DIMENSION), width: STANDARD_ICON_DIMENSION / 2, height: STANDARD_ICON_DIMENSION / 2, thickness: new Thickness(left: (((Thickness)removeButton.Margin).Left * 2.7) - STANDARD_SEPARATOR_DISTANCE, top: ((Thickness)removeButton.Margin).Top + removeButton.Height + (3 * STANDARD_SEPARATOR_DISTANCE), right: 0, bottom: 0));
            moveDownButton = new CustomButton(imageIcon: new CustomImage(imageName: "Icons/Toolbar Icon/go-down.png", width: STANDARD_SMALL_ICON_DIMENSION, height: STANDARD_SMALL_ICON_DIMENSION), width: (int)moveUpButton.Width, height: (int)moveUpButton.Height, thickness: new Thickness(left: ((Thickness)moveUpButton.Margin).Left, top: ((Thickness)moveUpButton.Margin).Top + moveUpButton.Height + STANDARD_SEPARATOR_DISTANCE, right: 0, bottom: 0));

            // Adding Components
            this.Content = canvas;
            canvas.Children.Add(iconsListView);
            addIconGroupBox.groupBoxCanvas.Children.Add(addFileButton);
            addIconGroupBox.groupBoxCanvas.Children.Add(addPathButton);
            addIconGroupBox.groupBoxCanvas.Children.Add(addSeparatorButton);
            organizeIconGroupBox.groupBoxCanvas.Children.Add(editButton);
            organizeIconGroupBox.groupBoxCanvas.Children.Add(removeButton);
            organizeIconGroupBox.groupBoxCanvas.Children.Add(moveUpButton);
            organizeIconGroupBox.groupBoxCanvas.Children.Add(moveDownButton);

            // Initializing
            setEnableOrDisableAllOrganizeIconButtons(status: false);
        }
コード例 #2
0
        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);
        }