示例#1
0
        private void on_btnImportPublicKey_clicked(object sender, EventArgs e)
        {
            FileSelector f = new FileSelector("Select Public Key");

            try {
                if (f.Run() == (int)ResponseType.Ok)
                {
                    txtPublicKey.Buffer.Text = File.ReadAllText(f.Filename);
                }
                f.Destroy();
            }
            catch (Exception) {
                f.Destroy();
                Gui.ShowMessageDialog("The selected file is not valid.", base.Dialog, Gtk.MessageType.Error, ButtonsType.Ok);
            }
        }
示例#2
0
        void on_m_SendFileMenuItem_activate(object o, EventArgs e)
        {
            FileSelector dialog = new FileSelector("Select file to send");

            dialog.Show();
            if (dialog.Run() == (int)Gtk.ResponseType.Ok)
            {
                network.SendFile(selectedNode, dialog.Filename);
            }
            dialog.Destroy();
        }
示例#3
0
        private void on_saveKeyButton_clicked(object o, EventArgs args)
        {
            FileSelector selector = new FileSelector("Save Public Key...", FileChooserAction.Save);

            selector.TransientFor = dialog;
            selector.CurrentName  = nicknameEntry.Text + ".mpk";
            if (selector.Run() == (int)ResponseType.Ok)
            {
                string publicKey = new PublicKey(nicknameEntry.Text, provider.ToXmlString(false)).ToArmoredString();
                File.WriteAllText(selector.Filename, publicKey);
            }
            selector.Destroy();
        }
示例#4
0
        /// <summary>Runs the default implementation of the dialog.</summary>
        protected override bool RunDefault()
        {
            var fdiag = new FileSelector();

            SetDefaultProperties(fdiag);
            try {
                int result = MessageService.RunCustomDialog(fdiag, data.TransientFor ?? MessageService.RootWindow);
                GetDefaultProperties(fdiag);
                return(result == (int)Gtk.ResponseType.Ok);
            } finally {
                fdiag.Destroy();
            }
        }
        protected override bool RunDefault()
        {
            FileSelector fdiag = new FileSelector(data.Title);

            //add a combo that can be used to override the default build action
            ComboBox combo = new ComboBox(data.BuildActions ?? new string[0]);

            combo.Sensitive        = false;
            combo.Active           = 0;
            combo.RowSeparatorFunc = delegate(TreeModel model, TreeIter iter)
            {
                return("--" == ((string)model.GetValue(iter, 0)));
            };

            CheckButton check = new CheckButton(GettextCatalog.GetString("Override default build action"));

            check.Toggled += delegate
            {
                combo.Sensitive = check.Active;
            };

            HBox box = new HBox();

            fdiag.ExtraWidget = box;
            box.PackStart(check, false, false, 4);
            box.PackStart(combo, false, false, 4);
            box.ShowAll();

            SetDefaultProperties(fdiag);

            int result;

            try
            {
                result = MessageService.RunCustomDialog(fdiag, data.TransientFor ?? MessageService.RootWindow);
                GetDefaultProperties(fdiag);
                if (check.Active)
                {
                    data.OverrideAction = combo.ActiveText;
                }
                else
                {
                    data.OverrideAction = null;
                }
                return(result == (int)Gtk.ResponseType.Ok);
            }
            finally
            {
                fdiag.Destroy();
            }
        }
示例#6
0
        private void addPluginButton_Clicked(object sender, EventArgs args)
        {
            FileSelector selector = new FileSelector("Select plugin to load");

            selector.Show();
            int result = selector.Run();

            if (result == (int)Gtk.ResponseType.Ok)
            {
                try {
                    PluginInfo info = new PluginInfo(selector.Filename);
                    pluginsListStore.AppendValues(info);
                } catch (Exception ex) {
                    Core.LoggingService.LogError(ex);
                }
            }
            selector.Destroy();
        }
示例#7
0
 private void on_saveKeyButton_clicked(object o, EventArgs args)
 {
     FileSelector selector = new FileSelector("Save Public Key...", FileChooserAction.Save);
     selector.TransientFor = dialog;
     selector.CurrentName = nicknameEntry.Text + ".mpk";
     if (selector.Run() == (int)ResponseType.Ok) {
         string publicKey = new PublicKey(nicknameEntry.Text, provider.ToXmlString(false)).ToArmoredString();
         File.WriteAllText(selector.Filename, publicKey);
     }
     selector.Destroy();
 }
示例#8
0
 private void addPluginButton_Clicked(object sender, EventArgs args)
 {
     FileSelector selector = new FileSelector ("Select plugin to load");
     selector.Show ();
     int result = selector.Run ();
     if (result == (int)Gtk.ResponseType.Ok) {
         try {
             PluginInfo info = new PluginInfo (selector.Filename);
             pluginsListStore.AppendValues (info);
         } catch (Exception ex) {
             LoggingService.LogError(ex);
         }
     }
     selector.Destroy();
 }
 private void on_browseInputFile_clicked(object o, EventArgs e)
 {
     FileSelector fileSelector = new FileSelector("Select Glade XML File");
     if (fileSelector.Run() == (int)Gtk.ResponseType.Ok)
         inputFileEntry.Text = fileSelector.Filename;
     fileSelector.Destroy();
 }