コード例 #1
0
        private void InitializeQuickSettingsMenu()
        {
            this.contextmenu_quicksettings.DropDownItems.Clear();
            // screenshot destination
            ToolStripMenuSelectList selectList = new ToolStripMenuSelectList("destinations", true);

            selectList.Text = Language.GetString(LangKey.settings_destination);
            // Working with IDestination:
            foreach (IDestination destination in DestinationHelper.GetAllDestinations())
            {
                selectList.AddItem(destination.Description, destination, conf.OutputDestinations.Contains(destination.Designation));
            }
            selectList.CheckedChanged += new EventHandler(this.QuickSettingDestinationChanged);
            this.contextmenu_quicksettings.DropDownItems.Add(selectList);

            // Capture Modes
            selectList      = new ToolStripMenuSelectList("capturemodes", false);
            selectList.Text = Language.GetString(LangKey.settings_window_capture_mode);
            string enumTypeName = typeof(WindowCaptureMode).Name;

            foreach (WindowCaptureMode captureMode in Enum.GetValues(typeof(WindowCaptureMode)))
            {
                selectList.AddItem(Language.GetString(enumTypeName + "." + captureMode.ToString()), captureMode, conf.WindowCaptureMode == captureMode);
            }
            selectList.CheckedChanged += new EventHandler(this.QuickSettingCaptureModeChanged);
            this.contextmenu_quicksettings.DropDownItems.Add(selectList);

            // print options
            selectList      = new ToolStripMenuSelectList("printoptions", true);
            selectList.Text = Language.GetString(LangKey.settings_printoptions);

            IniValue iniValue;

            foreach (string propertyName in conf.Values.Keys)
            {
                if (propertyName.StartsWith("OutputPrint"))
                {
                    iniValue = conf.Values[propertyName];
                    if (iniValue.Attributes.LanguageKey != null)
                    {
                        selectList.AddItem(Language.GetString(iniValue.Attributes.LanguageKey), iniValue, (bool)iniValue.Value);
                    }
                }
            }
            selectList.CheckedChanged += new EventHandler(this.QuickSettingBoolItemChanged);
            this.contextmenu_quicksettings.DropDownItems.Add(selectList);

            // effects
            selectList      = new ToolStripMenuSelectList("effects", true);
            selectList.Text = Language.GetString(LangKey.settings_visualization);

            iniValue = conf.Values["PlayCameraSound"];
            selectList.AddItem(Language.GetString(iniValue.Attributes.LanguageKey), iniValue, (bool)iniValue.Value);
            iniValue = conf.Values["ShowTrayNotification"];
            selectList.AddItem(Language.GetString(iniValue.Attributes.LanguageKey), iniValue, (bool)iniValue.Value);
            selectList.CheckedChanged += new EventHandler(this.QuickSettingBoolItemChanged);
            this.contextmenu_quicksettings.DropDownItems.Add(selectList);
        }
コード例 #2
0
ファイル: SettingsForm.cs プロジェクト: zhk/greenshot
        /// <summary>
        /// Build the view with all the destinations
        /// </summary>
        private void DisplayDestinations()
        {
            bool destinationsEnabled = true;

            if (coreConfiguration.Values.ContainsKey("Destinations"))
            {
                destinationsEnabled = !coreConfiguration.Values["Destinations"].IsFixed;
            }
            checkbox_picker.Checked = false;

            listview_destinations.Items.Clear();
            listview_destinations.ListViewItemSorter = new ListviewWithDestinationComparer();
            ImageList imageList = new ImageList();

            listview_destinations.SmallImageList = imageList;
            int imageNr = -1;

            foreach (IDestination currentDestination in DestinationHelper.GetAllDestinations())
            {
                Image destinationImage = currentDestination.DisplayIcon;
                if (destinationImage != null)
                {
                    imageList.Images.Add(currentDestination.DisplayIcon);
                    imageNr++;
                }
                if (PickerDestination.DESIGNATION.Equals(currentDestination.Designation))
                {
                    checkbox_picker.Checked = coreConfiguration.OutputDestinations.Contains(currentDestination.Designation);
                    checkbox_picker.Text    = currentDestination.Description;
                }
                else
                {
                    ListViewItem item;
                    if (destinationImage != null)
                    {
                        item = listview_destinations.Items.Add(currentDestination.Description, imageNr);
                    }
                    else
                    {
                        item = listview_destinations.Items.Add(currentDestination.Description);
                    }
                    item.Tag     = currentDestination;
                    item.Checked = coreConfiguration.OutputDestinations.Contains(currentDestination.Designation);
                }
            }
            if (checkbox_picker.Checked)
            {
                listview_destinations.Enabled = false;
                foreach (int index in listview_destinations.CheckedIndices)
                {
                    ListViewItem item = listview_destinations.Items[index];
                    item.Checked = false;
                }
            }
            checkbox_picker.Enabled       = destinationsEnabled;
            listview_destinations.Enabled = destinationsEnabled;
        }
コード例 #3
0
        /// <summary>
        /// Build the view with all the destinations
        /// </summary>
        private void DisplayDestinations()
        {
            checkbox_picker.Checked = false;

            destinationsListView.Items.Clear();
            destinationsListView.ListViewItemSorter = new ListviewWithDestinationComparer();
            ImageList imageList = new ImageList();

            destinationsListView.SmallImageList = imageList;
            int imageNr = -1;

            foreach (IDestination destination in DestinationHelper.GetAllDestinations())
            {
                Image destinationImage = destination.DisplayIcon;
                if (destinationImage != null)
                {
                    imageList.Images.Add(destination.DisplayIcon);
                    imageNr++;
                }
                if (PickerDestination.DESIGNATION.Equals(destination.Designation))
                {
                    checkbox_picker.Checked = coreConfiguration.OutputDestinations.Contains(destination.Designation);
                    checkbox_picker.Text    = destination.Description;
                }
                else
                {
                    ListViewItem item;
                    if (destinationImage != null)
                    {
                        item = destinationsListView.Items.Add(destination.Description, imageNr);
                    }
                    else
                    {
                        item = destinationsListView.Items.Add(destination.Description);
                    }
                    item.Tag     = destination;
                    item.Checked = coreConfiguration.OutputDestinations.Contains(destination.Designation);
                }
            }
            if (checkbox_picker.Checked)
            {
                destinationsListView.Enabled = false;
                foreach (int index in destinationsListView.CheckedIndices)
                {
                    ListViewItem item = destinationsListView.Items[index];
                    item.Checked = false;
                }
            }
        }
コード例 #4
0
 protected override void Initialize()
 {
     base.Initialize();
     if (coreConfiguration.OutputDestinations == null)
     {
         coreConfiguration.OutputDestinations = new List <string>();
     }
     foreach (IDestination destination in DestinationHelper.GetAllDestinations())
     {
         Destinations.Add(new DestinationSelectionContainer {
             Destination = destination,
             IsSelected  = coreConfiguration.OutputDestinations.Contains(destination.Designation)
         });
     }
 }
コード例 #5
0
        protected override void Initialize()
        {
            base.Initialize();
            if (coreConfiguration.PickerDestinations == null)
            {
                coreConfiguration.PickerDestinations = new List <string>();
            }

            if (coreConfiguration.PickerDestinations.Count > 0)
            {
                // Show selected (and active) destinations
                foreach (string designation in coreConfiguration.PickerDestinations)
                {
                    IDestination destination = DestinationHelper.GetDestination(designation);
                    if ("Picker".Equals(destination.Designation))
                    {
                        continue;
                    }
                    selectedDestinations.Add(destination);
                }
                foreach (IDestination destination in DestinationHelper.GetAllDestinations())
                {
                    // Skip picker
                    if ("Picker".Equals(destination.Designation))
                    {
                        continue;
                    }
                    if (!coreConfiguration.PickerDestinations.Contains(destination.Designation))
                    {
                        availableDestinations.Add(destination);
                    }
                }
            }
            else
            {
                foreach (IDestination destination in DestinationHelper.GetAllDestinations())
                {
                    // Skip picker
                    if ("Picker".Equals(destination.Designation))
                    {
                        continue;
                    }
                    selectedDestinations.Add(destination);
                }
            }
        }
コード例 #6
0
        /// <summary>
        /// Export the capture with the destination picker
        /// </summary>
        /// <param name="manuallyInitiated">Did the user select this destination?</param>
        /// <param name="surface">Surface to export</param>
        /// <param name="captureDetails">Details of the capture</param>
        /// <returns>true if export was made</returns>
        public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails)
        {
            List <IDestination> destinations = new List <IDestination>();

            if (conf.PickerDestinations != null && conf.PickerDestinations.Count > 0)
            {
                // Show selected (and active) destinations
                foreach (string designation in conf.PickerDestinations)
                {
                    IDestination destination = DestinationHelper.GetDestination(designation);
                    if (DESIGNATION.Equals(destination.Designation))
                    {
                        continue;
                    }
                    if (!destination.IsActive)
                    {
                        continue;
                    }
                    destinations.Add(destination);
                }
            }
            else
            {
                // Show active destinations
                foreach (IDestination destination in DestinationHelper.GetAllDestinations())
                {
                    if ("Picker".Equals(destination.Designation))
                    {
                        continue;
                    }
                    if (!destination.IsActive)
                    {
                        continue;
                    }
                    destinations.Add(destination);
                }
            }


            // No Processing, this is done in the selected destination (if anything was selected)
            return(ShowPickerMenu(true, surface, captureDetails, destinations));
        }
コード例 #7
0
        /// <summary>
        /// Export the capture with the destination picker
        /// </summary>
        /// <param name="manuallyInitiated">Did the user select this destination?</param>
        /// <param name="surface">Surface to export</param>
        /// <param name="captureDetails">Details of the capture</param>
        /// <returns>true if export was made</returns>
        public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails)
        {
            List <IDestination> destinations = new List <IDestination>();

            foreach (IDestination destination in DestinationHelper.GetAllDestinations())
            {
                if ("Picker".Equals(destination.Designation))
                {
                    continue;
                }
                if (!destination.isActive)
                {
                    continue;
                }
                destinations.Add(destination);
            }

            // No Processing, this is done in the selected destination (if anything was selected)
            return(ShowPickerMenu(true, surface, captureDetails, destinations));
        }
コード例 #8
0
        public override bool ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails)
        {
            List <IDestination> destinations = new List <IDestination>();

            foreach (IDestination destination in DestinationHelper.GetAllDestinations())
            {
                if ("Picker".Equals(destination.Designation))
                {
                    continue;
                }
                if (!destination.isActive)
                {
                    continue;
                }
                destinations.Add(destination);
            }

            ContextMenuStrip menu = CreatePickerMenu(true, surface, captureDetails, destinations);

            ShowMenuAtCursor(menu);
            return(true);
        }