Пример #1
0
        }        //func

        #endregion

        #region Window Events
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            mActionItems = new ObservableCollection <ActionItem>();
            mActionTypes.Add(new Tuple <string, string>("script", "C# Script"));
            mActionTypes.Add(new Tuple <string, string>("cmd", "Executable"));
            mActionTypes.Add(new Tuple <string, string>("kb", "Keyboard"));
            this.DataContext = mActionTypes;

            lvActions.ItemsSource = mActionItems;

            mCommandItems = new ObservableCollection <CommandItem>();
            if (!String.IsNullOrEmpty(mProfileName))
            {
                mProfile = sp.Profile.Load(mProfileName);
                if (mProfile != null)
                {
                    tbProfileName.Text = mProfile.Name;

                    foreach (var cmd in mProfile.Commands)
                    {
                        mCommandItems.Add(new CommandItem()
                        {
                            ObjRef = cmd, Synth = cmd.Synth, Grammar = String.Join(", ", cmd.Grammar)
                        });
                    }                    //for
                }                        //if
            }
            else
            {
                mProfile = new sp.Profile(); //Create a new Profile
            }                                //if

            lvCommands.ItemsSource = mCommandItems;
        }                //func
Пример #2
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            mActionItems = new ObservableCollection<ActionItem>();
                mActionTypes.Add(new Tuple<string,string>("script","C# Script"));
                mActionTypes.Add(new Tuple<string,string>("cmd","Executable"));
                mActionTypes.Add(new Tuple<string,string>("kb","Keyboard"));
                this.DataContext = mActionTypes;

                lvActions.ItemsSource = mActionItems;

                mCommandItems = new ObservableCollection<CommandItem>();
                if(!String.IsNullOrEmpty(mProfileName)) {
                    mProfile = sp.Profile.Load(mProfileName);
                    if(mProfile != null){
                        tbProfileName.Text = mProfile.Name;

                        foreach(var cmd in mProfile.Commands){
                            mCommandItems.Add(new CommandItem(){ ObjRef=cmd, Synth=cmd.Synth, Grammar=String.Join(", ",cmd.Grammar) });
                        }//for
                    }//if
                }else{
                    mProfile = new sp.Profile(); //Create a new Profile
                }//if

                lvCommands.ItemsSource = mCommandItems;
        }