Beispiel #1
0
        /// <summary>
        /// Creates a List of <see cref="AhkKeyMapAhkMapValue"/> objects representing all the Value
        /// in T enum. The List is Sorted Based upon <see cref="AhkKeyMapAhkMapValue.Sort"/>
        /// </summary>
        /// <param name="SelectedValues">
        /// Instance of <see cref="SelectedOptions{T}"/>. Each value in SelectedValues will set the
        /// corresponding <see cref="AhkKeyMapAhkMapValue.Selected"/> to true;
        /// </param>
        /// <param name="ExcludeRules">
        /// If any rule matches the exclude then the matched item will not be
        /// outputted in the list.
        /// </param>
        /// <returns>
        /// List of <see cref="AhkKeyMapAhkMapValue"/>
        /// </returns>
        /// <remarks>
        /// <see cref="AhkKeyMapAhkMapValue.Parent"/> is set to the List.
        /// </remarks>
        public virtual List <AhkKeyMapAhkMapValue> ToList(SelectedOptions <T> SelectedValues, EnumRule <T> ExcludeRules)
        {
            List <AhkKeyMapAhkMapValue> SortList = new List <AhkKeyMapAhkMapValue>();

            if (this.AhkMapValue == null)
            {
                return(SortList);
            }

            foreach (var map in this.AhkMapValue)
            {
                AhkKeyMapAhkMapValue newMap = new AhkKeyMapAhkMapValue();
                if (ExcludeRules[map.Key])
                {
                    // exclude rule continue
                    continue;
                }
                // newMap.Parent = bl;
                newMap.AutoHotKeyValue = map.AutoHotKeyValue;
                newMap.DisplayValue    = map.DisplayValue;
                newMap.Key             = map.Key;
                newMap.Sort            = map.Sort;
                if (SelectedValues.HasKey[map.Key])
                {
                    newMap.Selected = true;
                }
                newMap.Parent = SortList;
                SortList.Add(newMap);
            }
            // Sort the list based upon sort values for display.
            // This comes into play when the binding list is bound to a list control
            // such as a drop down list.
            SortList.Sort((value1, value2) => value1.Sort.CompareTo(value2.Sort));
            return(SortList);
        }
Beispiel #2
0
 private void ddlSend_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (IsLoaded == false)
     {
         return;
     }
     if (this.m_HotStringValue == null)
     {
         return;
     }
     if (ddlSend.SelectedItem != null)
     {
         AhkKeyMapAhkMapValue Sendval         = (AhkKeyMapAhkMapValue)ddlSend.SelectedItem;
         HotStringSendEnum    currentSendEnum = (HotStringSendEnum)Enum.Parse(typeof(HotStringSendEnum), Sendval.Key);
         this.HotStringValue.Options.SendMethod = currentSendEnum;
     }
 }
Beispiel #3
0
        /// <summary>
        /// Binds the Send type Drop down list Filtering by Hotstring Type
        /// </summary>
        public void BindSendType()
        {
            if (m_HotStringValue == null)
            {
                return;
            }
            SelectedOptions <HotStringSendEnum> SendOptions = new SelectedOptions <HotStringSendEnum>();

            if (this.HotStringValue.type == hotstringType.Inline)
            {
                EnumRule <HotStringSendEnum> SendExclude = new EnumRule <HotStringSendEnum>();
                SendExclude.Add(HotStringSendEnum.None);

                SendTypes = HotstringSendMethodMap.Instance.ToBindingList(SendOptions, SendExclude);
            }
            else
            {
                SendTypes = HotstringSendMethodMap.Instance.ToBindingList(SendOptions);
            }
            ddlSend.DataSource = null;
            ddlSend.Items.Clear();

            ddlSend.DisplayMember = "DisplayValue";
            ddlSend.ValueMember   = "Key";
            ddlSend.DataSource    = SendTypes;


            if (ddlSend.Items.Count > 0)
            {
                ddlSend.SelectedIndex = 0;
                for (int i = 0; i < ddlSend.Items.Count; i++)
                {
                    AhkKeyMapAhkMapValue mv = (AhkKeyMapAhkMapValue)ddlSend.Items[i];
                    if (mv.Selected == true)
                    {
                        ddlSend.SelectedIndex = i;
                        break;
                    }
                }
            }
        }
Beispiel #4
0
        /// <summary>
        /// Creates a Binding List of <see cref="AhkKeyMapAhkMapValue"/> objects representing all the Value
        /// in T enum. The List is Sorted Based upon <see cref="AhkKeyMapAhkMapValue.Sort"/>
        /// </summary>
        /// <param name="SelectedValues">
        /// Instance of <see cref="SelectedOptions{T}"/>. Each value in SelectedValues will set the
        /// corresponding <see cref="AhkKeyMapAhkMapValue.Selected"/> to true;
        /// </param>
        /// <returns>
        /// Binding list of <see cref="AhkKeyMapAhkMapValue"/>
        /// </returns>
        /// <remarks>
        /// <see cref="AhkKeyMapAhkMapValue.Parent"/> is set to the Binding List.
        /// </remarks>
        public virtual BindingList <AhkKeyMapAhkMapValue> ToBindingList(SelectedOptions <T> SelectedValues)
        {
            BindingList <AhkKeyMapAhkMapValue> bl = new BindingList <AhkKeyMapAhkMapValue>();

            if (this.AhkMapValue == null)
            {
                return(bl);
            }
            List <AhkKeyMapAhkMapValue> SortList = new List <AhkKeyMapAhkMapValue>();

            foreach (var map in this.AhkMapValue)
            {
                AhkKeyMapAhkMapValue newMap = new AhkKeyMapAhkMapValue();
                // newMap.Parent = bl;
                newMap.AutoHotKeyValue = map.AutoHotKeyValue;
                newMap.DisplayValue    = map.DisplayValue;
                newMap.Key             = map.Key;
                newMap.Sort            = map.Sort;
                if (SelectedValues.HasKey[map.Key])
                {
                    newMap.Selected = true;
                }
                SortList.Add(newMap);
            }
            // Sort the list based upon sort values for display.
            // This comes into play when the binding list is bound to a list control
            // such as a drop down list.
            SortList.Sort((value1, value2) => value1.Sort.CompareTo(value2.Sort));

            // Now that the list is sorted add the values to the binding list.
            foreach (var map in SortList)
            {
                map.Parent = bl;
                bl.Add(map);
            }
            SortList.Clear();
            return(bl);
        }
        private void frmProfile_Load(object sender, EventArgs e)
        {
            windowsBindingSource.DataSource = windows;
            ProfileName.FieldEnabled        = this.IsNew;
            if (this.IsNew)
            {
                // this app knows what the min version it works on for any
                // profile it creates so no reason to bother end user with min version.
                pf.minVersion = AppCommon.Instance.DefaultMinVersion.ToString();
            }


            if (pf.profileEndChars == null)
            {
                EndCharsBindingList = EndCharKeyMap.Instance.ToBindingList();
            }
            else
            {
                if (pf.profileEndChars == null || pf.profileEndChars.Length == 0)
                {
                    EndCharsBindingList = EndCharKeyMap.Instance.ToBindingList();
                }
                else
                {
                    var ec = EndCharsSelectedOptions.FromArray(pf.profileEndChars);
                    EndCharsBindingList = EndCharKeyMap.Instance.ToBindingList(ec);
                }
            }
            bsEndChars.DataSource = this.EndCharsBindingList;


            ((ListBox)this.clbEndChars).DataSource    = bsEndChars;
            ((ListBox)this.clbEndChars).DisplayMember = "DisplayValue";
            ((ListBox)this.clbEndChars).ValueMember   = "Selected";

            for (int i = 0; i < clbEndChars.Items.Count; i++)
            {
                AhkKeyMapAhkMapValue mv = (AhkKeyMapAhkMapValue)clbEndChars.Items[i];
                clbEndChars.SetItemChecked(i, mv.Selected);
            }

            if (Properties.Settings.Default.ProWindowState == FormWindowState.Maximized)
            {
                WindowState = FormWindowState.Maximized;
                Location    = Properties.Settings.Default.ProLocation;
                Size        = Properties.Settings.Default.ProSize;
            }
            else if (Properties.Settings.Default.ProWindowState == FormWindowState.Minimized)
            {
                WindowState = FormWindowState.Minimized;
                Location    = Properties.Settings.Default.ProLocation;
                Size        = Properties.Settings.Default.ProSize;
            }
            else
            {
                Location = Properties.Settings.Default.ProLocation;
                Size     = Properties.Settings.Default.ProSize;
            }
            mnuEditCut.Image    = Z.IconLibrary.Silk.Icon.Cut.GetImage();
            mnuEditCopy.Image   = Z.IconLibrary.Silk.Icon.PageCopy.GetImage();
            mnuEditPaste.Image  = Z.IconLibrary.Silk.Icon.PagePaste.GetImage();
            mnuEditDelete.Image = Z.IconLibrary.Silk.Icon.Delete.GetImage();
            mnuEditUndo.Image   = Z.IconLibrary.Silk.Icon.ArrowUndo.GetImage();

            cMnuEditCut.Image    = Z.IconLibrary.Silk.Icon.Cut.GetImage();
            cMnuEditCopy.Image   = Z.IconLibrary.Silk.Icon.PageCopy.GetImage();
            cMnuEditPaste.Image  = Z.IconLibrary.Silk.Icon.PagePaste.GetImage();
            cMnuEditDelete.Image = Z.IconLibrary.Silk.Icon.Delete.GetImage();
            cMnuEditUndo.Image   = Z.IconLibrary.Silk.Icon.ArrowUndo.GetImage();

            this.SetTextBoxGeneralEvents();
            this.AddTextBoxEditHandlers();
        }