コード例 #1
0
        private void RegisterMacro_Click(object sender, RoutedEventArgs e)
        {
            if (m_MacroList.SelectedItem != null)
            {

                if (m_MacroList.SelectedItem is ObjectBuilder)
                {
                    App app = (App)App.Current;
                    //app.registerMacroInScript(m_MacroList.SelectedItem as ObjectBuilder);
                    ObjectBuilder obj = m_MacroList.SelectedItem as ObjectBuilder;
                    if (obj != null)
                    {
                        StringQueryItem qry = new StringQueryItem("Enter macro name", "Macro Registration", "Macro");
                        StringQuery q = new StringQuery();
                        q.DataContext = qry;
                        bool? result = q.ShowDialog();
                        if (result.Value)
                        {
                            if (result.Value)
                            {
                                Main.MessageHandler.registerMacro(qry.Text, obj);
                            }
                        }

                    }
                    sortMacros();
                }
            }
        }
コード例 #2
0
 private void BtnRenameProfile_Click(object sender, EventArgs e)
 {
     if (this.ProfileListBox.SelectedItem == null)
     {
         return;
     }
     Profile profile = this.ProfileListBox.SelectedItem as Profile;
     StringQuery stringQuery = new StringQuery("Rename Profile", "Enter the new profile name:");
     if (stringQuery.ShowDialog() == DialogResult.OK)
     {
         string text = Path.Combine(Profile.ProfileFolder, Path.GetFileNameWithoutExtension(profile.ProfileName) + ".settings");
         profile.ProfileName = stringQuery.string_0;
         profile.SaveToFile();
         string destFileName = Path.Combine(Profile.ProfileFolder, Path.GetFileNameWithoutExtension(stringQuery.string_0) + ".settings");
         if (File.Exists(text))
         {
             File.Move(text, destFileName);
         }
         this.method_1();
     }
 }