示例#1
0
        private void BtnLoad_Click(object sender, EventArgs e)
        {
            var form = new frmLoad(GetSaves().ToArray());

            form.btnLoad.Click += (ls, le) =>
            {
                if (form.lbSaves.SelectedIndex < 0)
                {
                    return;
                }
                var saveName = form.lbSaves.SelectedItem as string;
                if (string.IsNullOrEmpty(saveName))
                {
                    return;
                }
                tab.ChangeVariablesList(variablesList = new VariablesList(savesPath, saveName));
                form.Close();
            };
            form.ShowDialog();
        }
示例#2
0
        private void BtnNew_Click(object sender, EventArgs e)
        {
            var form = new frmNew();

            form.btnCreate.Click += (ls, le) =>
            {
                if (string.IsNullOrEmpty(form.tbNewName.Text))
                {
                    return;
                }
                if (GetSaves().Contains(form.tbNewName.Text))
                {
                    Utils.Alert("Error", "List name is already taken.");
                    return;
                }
                variablesList.Save();
                tab.ChangeVariablesList(variablesList = new VariablesList(savesPath, form.tbNewName.Text));
                form.Close();
            };
            form.ShowDialog();
        }
示例#3
0
        public void OnLoad()
        {
            try
            {
                page            = new TabPage("Composer Variables");
                page.ImageIndex = (int)SessionIcons.Script;

                tab = new Tab();
                tab.ChangeVariablesList(variablesList = new VariablesList(savesPath, defaultSaveName));
                tab.Dock           = DockStyle.Fill;
                tab.btnLoad.Click += BtnLoad_Click;
                tab.btnNew.Click  += BtnNew_Click;
                tab.btnSave.Click += BtnSave_Click;
                page.Controls.Add(tab);

                FiddlerApplication.UI.tabsViews.TabPages.Add(page);
            }
            catch
            {
                Utils.Alert("Error", "Failed to initialize addon.");
            }
        }
示例#4
0
 public void ChangeVariablesList(VariablesList variablesList)
 {
     bs.DataSource   = variablesList;
     tbFilename.Text = variablesList.SaveName;
 }