Exemplo n.º 1
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();
                fdiag.Dispose();
            }
        }
Exemplo n.º 2
0
        protected override bool RunDefault()
        {
            FileSelector fdiag = new FileSelector(data.Title);

            fdiag.ShowHidden = data.ShowHidden;

            //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();
                fdiag.Dispose();
            }
        }