Esempio n. 1
0
        /// <summary>
        /// Adds a new stored region.
        /// </summary>
        /// <param name="rectangle">Region bounds.</param>
        /// <param name="regionName">Name of the region.</param>
        /// <param name="isRelative">Whether the region is relative to the border.</param>
        private void StoreCurrentRegion(string regionName)
        {
            StoredRegion storedRegion = new StoredRegion(this.ConstructCurrentRegion(), regionName);

            int index = comboRegions.Items.Add(storedRegion);

            comboRegions.SelectedIndex = index;

            if (Settings.Default.SavedRegions == null)
            {
                Settings.Default.SavedRegions = new StoredRegionArray();
            }
            Settings.Default.SavedRegions.Add(storedRegion);
        }
Esempio n. 2
0
        /// <summary>
        /// Sets the current selected region to a specific instance of a stored region.
        /// </summary>
        /// <param name="region">A stored region instance or null to reset.</param>
        public void SetRegion(StoredRegion region)
        {
            if (region == null)
            {
                Reset();
                return;
            }

            SetRegion(region.Region);

            //Select right combobox
            if (comboRegions.Items.Contains(region))
            {
                comboRegions.SelectedItem = region;
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Sets the current selected region to a specific instance of a stored region.
        /// </summary>
        /// <param name="region">A stored region instance or null to reset.</param>
        public void SetRegion(StoredRegion region)
        {
            if (region == null) {
                Reset();
                return;
            }

            SetRegion(region.Region);

            //Select right combobox
            if (comboRegions.Items.Contains(region)) {
                comboRegions.SelectedItem = region;
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Adds a new stored region.
        /// </summary>
        /// <param name="rectangle">Region bounds.</param>
        /// <param name="regionName">Name of the region.</param>
        /// <param name="isRelative">Whether the region is relative to the border.</param>
        private void StoreCurrentRegion(string regionName)
        {
            StoredRegion storedRegion = new StoredRegion(this.ConstructCurrentRegion(), regionName);

            int index = comboRegions.Items.Add(storedRegion);
            comboRegions.SelectedIndex = index;

            if (Settings.Default.SavedRegions == null)
                Settings.Default.SavedRegions = new StoredRegionArray();
            Settings.Default.SavedRegions.Add(storedRegion);
        }
Esempio n. 5
0
        /// <summary>
        /// Adds a new stored region.
        /// </summary>
        /// <param name="rectangle">Region bounds.</param>
        /// <param name="regionName">Name of the region.</param>
        private void AddRegion(Rectangle rectangle, string regionName)
        {
            var region = new StoredRegion(rectangle, regionName);

            int index = comboRegions.Items.Add(region);
            comboRegions.SelectedIndex = index;

            if (Settings.Default.SavedRegions == null)
                Settings.Default.SavedRegions = new StoredRegionArray();
            Settings.Default.SavedRegions.Add(region);
        }