Beispiel #1
0
        public override void LaunchDialogue()
        {
            //dialogue and buttons
            Dialog dialog = new Dialog();

            dialog.Title       = "Expandable Object Editor ";
            dialog.Modal       = true;
            dialog.AllowGrow   = true;
            dialog.AllowShrink = true;
            dialog.Modal       = true;
            dialog.AddActionWidget(new Button(Stock.Cancel), ResponseType.Cancel);
            dialog.AddActionWidget(new Button(Stock.Ok), ResponseType.Ok);

            //propGrid
            grid = new PropertyGrid(parentRow.ParentGrid.EditorManager);
            grid.CurrentObject = parentRow.PropertyValue;
            grid.WidthRequest  = 200;
            grid.ShowHelp      = false;
            dialog.VBox.PackStart(grid, true, true, 5);

            //show and get response
            dialog.ShowAll();
            ResponseType response = (ResponseType)dialog.Run();

            dialog.Destroy();

            //if 'OK' put items back in collection
            if (response == ResponseType.Ok)
            {
            }

            //clean up so we start fresh if launched again
        }
Beispiel #2
0
        /// <summary>
        /// Activated when the user clicks the "Configure" button. Opens a new dialog containing the configuration
        /// widget of the selected plugin
        /// </summary>
        /// <param name="sender">
        /// A <see cref="System.Object"/> -- not used
        /// </param>
        /// <param name="e">
        /// A <see cref="EventArgs"/> -- not used
        /// </param>
        void OnConfigureButtonClicked(object sender, EventArgs e)
        {
            LiveRadioPluginListModel model  = plugin_view.Model as LiveRadioPluginListModel;
            ILiveRadioPlugin         plugin = model[plugin_view.Model.Selection.FocusedIndex];

            Dialog dialog = new Dialog();

            dialog.Title               = String.Format("LiveRadio Plugin {0} configuration", plugin.Name);
            dialog.IconName            = "gtk-preferences";
            dialog.Resizable           = false;
            dialog.BorderWidth         = 6;
            dialog.ContentArea.Spacing = 12;

            dialog.ContentArea.PackStart(plugin.ConfigurationWidget, false, false, 0);

            Button save_button   = new Button(Stock.Save);
            Button cancel_button = new Button(Stock.Cancel);

            dialog.AddActionWidget(cancel_button, 0);
            dialog.AddActionWidget(save_button, 0);

            cancel_button.Clicked += delegate { dialog.Destroy(); };
            save_button.Clicked   += delegate {
                plugin.SaveConfiguration();
                dialog.Destroy();
            };

            dialog.ShowAll();
        }
        protected override bool RunDefault()
        {
            Dialog md = null;

            try {
                md = new Dialog(Caption, TransientFor, DialogFlags.Modal | DialogFlags.DestroyWithParent)
                {
                    HasSeparator = false,
                    BorderWidth  = 6,
                };

                var questionLabel = new Label(Question)
                {
                    UseMarkup = true,
                    Xalign    = 0.0F,
                };
                md.VBox.PackStart(questionLabel, true, false, 6);

                var responseEntry = new Entry(Value ?? "")
                {
                    Visibility = !IsPassword,
                };
                responseEntry.Activated += (sender, e) => {
                    md.Respond(ResponseType.Ok);
                };
                md.VBox.PackStart(responseEntry, false, true, 6);

                md.AddActionWidget(new Button(Gtk.Stock.Cancel)
                {
                    CanDefault = true
                }, ResponseType.Cancel);
                md.AddActionWidget(new Button(Gtk.Stock.Ok), ResponseType.Ok);

                md.DefaultResponse = ResponseType.Cancel;

                md.Child.ShowAll();

                var response = (ResponseType)MonoDevelop.Ide.MessageService.RunCustomDialog(md, TransientFor);
                if (response == ResponseType.Ok)
                {
                    Value = responseEntry.Text;
                    return(true);
                }

                return(false);
            } finally {
                if (md != null)
                {
                    md.Destroy();
                    md.Dispose();
                }
            }
        }
Beispiel #4
0
    private void OnPreferences(object o, EventArgs args)
    {
        if (prefsdlg == null)
        {
            Button btn;
            HBox   split;
            VBox   left, right;
            Button songdirbtn;

            prefsdlg       = new Dialog();
            prefsdlg.Modal = true;
            prefsdlg.Title = "SharpMusique Preferences";
            prefsdlg.SetSizeRequest(500, -1);

            split = new HBox();
            prefsdlg.VBox.Add(split);
            left  = new VBox(true, 0);
            right = new VBox(true, 0);
            split.PackStart(left, false, false, 5);
            split.PackEnd(right, true, true, 10);

            songdirbtn          = new Button("Song Folder: ");
            songdirbtn.Clicked += new EventHandler(OnSongDirSelected);

            songdirentry = new Entry();

            left.PackStart(songdirbtn, false, false, 10);
            right.PackStart(songdirentry, false, false, 10);

            btn = new Button("Cancel");
            prefsdlg.AddActionWidget(btn, ResponseType.Cancel);

            btn = new Button("Save");
            prefsdlg.AddActionWidget(btn, ResponseType.Ok);

            prefsdlg.Response += new ResponseHandler(OnPreferencesResponse);
        }

        songdirentry.Text = strSongDir;

        prefsdlg.TransientFor = this.MainWindow;
        prefsdlg.SetPosition(WindowPosition.CenterOnParent);

        prefsdlg.ShowAll();
        prefsdlg.Run();
    }
Beispiel #5
0
        /// <summary>
        /// <c>SymbolLabelEditorDialog</c>'s constructor.
        /// </summary>
        /// <param name="parent">
        /// This dialog parent's window.
        /// </param>
        public SymbolLabelListDialog(Window parent)
        {
            XML gxml = new XML(null, "gui.glade", "symbolLabelEditorDialog", null);

            gxml.Autoconnect(this);

            symbolLabelEditorDialog.TransientFor = parent;

            symbolLabelEditorDialog.AddActionWidget(okBtn, ResponseType.Ok);
        }
Beispiel #6
0
            public string GetTextResponse(string question, string caption, string initialValue, bool isPassword)
            {
                string returnValue = null;

                Dialog md = new Dialog(caption, rootWindow, DialogFlags.Modal | DialogFlags.DestroyWithParent);

                try {
                    // add a label with the question
                    Label questionLabel = new Label(question);
                    questionLabel.UseMarkup = true;
                    questionLabel.Xalign    = 0.0F;
                    md.VBox.PackStart(questionLabel, true, false, 6);

                    // add an entry with initialValue
                    Entry responseEntry = (initialValue != null) ? new Entry(initialValue) : new Entry();
                    md.VBox.PackStart(responseEntry, false, true, 6);
                    responseEntry.Visibility = !isPassword;

                    // add action widgets
                    md.AddActionWidget(new Button(Gtk.Stock.Cancel), ResponseType.Cancel);
                    md.AddActionWidget(new Button(Gtk.Stock.Ok), ResponseType.Ok);

                    md.VBox.ShowAll();
                    md.ActionArea.ShowAll();
                    md.HasSeparator = false;
                    md.BorderWidth  = 6;

                    PlaceDialog(md, rootWindow);

                    int response = md.Run();
                    md.Hide();

                    if ((ResponseType)response == ResponseType.Ok)
                    {
                        returnValue = responseEntry.Text;
                    }

                    return(returnValue);
                } finally {
                    md.Destroy();
                }
            }
        public void AddButton(string message, ResponseType response, bool isDefault, bool isStock)
        {
            Button button = new Button(message);

            button.CanDefault = true;
            button.UseStock   = isStock;
            button.Show();

            Dialog.AddActionWidget(button, response);

            if (isDefault)
            {
                Dialog.DefaultResponse = response;
                button.AddAccelerator("activate", accel_group, (uint)Gdk.Key.Return,
                                      0, AccelFlags.Visible);
            }
        }
        /// <summary>
        /// Inicializa los controles del dialogo.
        /// </summary>
        private void InitializeWidgets()
        {
            // Nos traemos el Glade
            Glade.XML gladeXML =
                Glade.XML.FromAssembly("mathtextrecognizer.glade",
                                       "databaseManagerDialog",
                                       null);

            gladeXML.Autoconnect(this);

            databaseManagerDialog.AddActionWidget(closeBtn, ResponseType.Close);

            // Creamos el modelo de la lista de bases de datos,
            // para que contenga el tipo de la base de datos, el archivo que
            // la contiene, y el objecto DatabaseFileInfo asociado.
            databasesLS = new ListStore(typeof(string),
                                        typeof(string),
                                        typeof(string),
                                        typeof(DatabaseFileInfo));
            databasesTV.Model = databasesLS;


            databasesTV.AppendColumn("Archivo",
                                     new CellRendererText(),
                                     "text",
                                     0);

            databasesTV.AppendColumn("Tipo",
                                     new CellRendererText(),
                                     "text",
                                     1);

            databasesTV.Columns[0].Sizing = TreeViewColumnSizing.Autosize;

            databasesTV.Selection.Changed +=
                new EventHandler(OnDatabasesTVSelectionChanged);

            databaseManagerDialog.Icon = ImageResources.LoadPixbuf("database16");
        }
Beispiel #9
0
        /// <summary>
        /// Constructor. Initialises the view.
        /// </summary>
        /// <param name="owner"></param>
        public HelpView(MainView owner) : base(owner)
        {
            window = new Dialog("Help", owner.MainWidget as Window, DialogFlags.DestroyWithParent | DialogFlags.Modal | DialogFlags.NoSeparator);
            window.WindowPosition = WindowPosition.Center;
            window.DeleteEvent   += OnDelete;
            window.Destroyed     += OnClose;
            window.Resizable      = false;
            VBox container = new VBox(true, 10);

            container.Homogeneous = false;

            Frame websiteFrame = new Frame("Website");

            website          = new LinkButton("https://apsimnextgeneration.netlify.com", "Apsim Next Generation Website");
            website.Clicked += OnWebsiteClicked;
            website.SetAlignment(0, 0);
            websiteFrame.Add(website);
            container.PackStart(websiteFrame, false, false, 0);

            Frame citationFrame = new Frame("Acknowledgement");
            Label citation      = new Label(citationMarkup);

            citation.Selectable = true;
            citation.UseMarkup  = true;

            // fixme - this is very crude. Unfortunately, if we turn on
            // word wrapping, the label's text will not resize if we
            // resize the window, and the default width will be very
            // narrow. This will force the label to be 640px wide.
            citation.WidthRequest = 640;
            citation.Wrap         = true;

            citationFrame.Add(citation);
            container.PackStart(citationFrame, true, true, 0);
            window.AddActionWidget(container, ResponseType.None);
            mainWidget = window;
        }
Beispiel #10
0
        private void ShowDialog(Widget content)
        {
            var dialog = new Dialog("Charlie Dialog", _window,
                                    DialogFlags.Modal)
            {
                WidthRequest    = 300,
                Decorated       = false,
                WindowPosition  = WindowPosition.CenterOnParent,
                BorderWidth     = 0,
                SkipTaskbarHint = true
            };

            _window.GetPosition(out var winX, out var winY);
            dialog.GetPosition(out var x, out var y);
            dialog.Move(x, winY + 30);

            dialog.AddActionWidget(new Button("Ok"), ResponseType.Close);
            dialog.ContentArea.Spacing = 10;
            dialog.ContentArea.Add(content);

            dialog.ShowAll();
            dialog.Run();
            dialog.Dispose();
        }
Beispiel #11
0
        public override void LaunchDialogue()
        {
            //the Type in the collection
            IList  collection  = (IList)Value;
            string displayName = Inspector.DisplayName;

            //populate list with existing items
            ListStore itemStore = new ListStore(typeof(object), typeof(int), typeof(string));

            for (int i = 0; i < collection.Count; i++)
            {
                itemStore.AppendValues(collection [i], i, collection [i].ToString());
            }

            #region Building Dialogue

            TreeView      itemTree;
            InspectorGrid grid;
            TreeIter      previousIter = TreeIter.Zero;

            //dialogue and buttons
            Dialog dialog = new Dialog()
            {
                Title       = displayName + " Editor",
                Modal       = true,
                AllowGrow   = true,
                AllowShrink = true,
            };
            var toplevel = this.Container.Toplevel as Window;
            if (toplevel != null)
            {
                dialog.TransientFor = toplevel;
            }

            dialog.AddActionWidget(new Button(Stock.Cancel), ResponseType.Cancel);
            dialog.AddActionWidget(new Button(Stock.Ok), ResponseType.Ok);

            //three columns for items, sorting, PropGrid
            HBox hBox = new HBox();
            dialog.VBox.PackStart(hBox, true, true, 5);

            //propGrid at end
            grid = new InspectorGrid(base.EditorManager)
            {
                CurrentObject = null,
                WidthRequest  = 200,
                ShowHelp      = false
            };
            hBox.PackEnd(grid, true, true, 5);

            //followed by a ButtonBox
            VBox buttonBox = new VBox();
            buttonBox.Spacing = 6;
            hBox.PackEnd(buttonBox, false, false, 5);

            //add/remove buttons
            Button addButton = new Button(new Image(Stock.Add, IconSize.Button));
            buttonBox.PackStart(addButton, false, false, 0);
            if (types [0].IsAbstract)
            {
                addButton.Sensitive = false;
            }
            Button removeButton = new Button(new Gtk.Image(Stock.Remove, IconSize.Button));
            buttonBox.PackStart(removeButton, false, false, 0);

            //sorting buttons
            Button upButton = new Button(new Image(Stock.GoUp, IconSize.Button));
            buttonBox.PackStart(upButton, false, false, 0);
            Button downButton = new Button(new Image(Stock.GoDown, IconSize.Button));
            buttonBox.PackStart(downButton, false, false, 0);

            //Third column has list(TreeView) in a ScrolledWindow
            ScrolledWindow listScroll = new ScrolledWindow();
            listScroll.WidthRequest  = 200;
            listScroll.HeightRequest = 320;
            hBox.PackStart(listScroll, false, false, 5);

            itemTree = new TreeView(itemStore);
            itemTree.Selection.Mode = SelectionMode.Single;
            itemTree.HeadersVisible = false;
            listScroll.AddWithViewport(itemTree);

            //renderers and attribs for TreeView
            CellRenderer rdr = new CellRendererText();
            itemTree.AppendColumn(new TreeViewColumn("Index", rdr, "text", 1));
            rdr = new CellRendererText();
            itemTree.AppendColumn(new TreeViewColumn("Object", rdr, "text", 2));

            #endregion

            #region Events

            addButton.Clicked += delegate {
                //create the object
                object instance = System.Activator.CreateInstance(types[0]);

                //get existing selection and insert after it
                TreeIter oldIter, newIter;
                if (itemTree.Selection.GetSelected(out oldIter))
                {
                    newIter = itemStore.InsertAfter(oldIter);
                }
                //or append if no previous selection
                else
                {
                    newIter = itemStore.Append();
                }
                itemStore.SetValue(newIter, 0, instance);

                //select, set name and update all the indices
                itemTree.Selection.SelectIter(newIter);
                UpdateName(itemStore, newIter);
                UpdateIndices(itemStore);
            };

            removeButton.Clicked += delegate {
                //get selected iter and the replacement selection
                TreeIter iter, newSelection;
                if (!itemTree.Selection.GetSelected(out iter))
                {
                    return;
                }

                newSelection = iter;
                if (!IterPrev(itemStore, ref newSelection))
                {
                    newSelection = iter;
                    if (!itemStore.IterNext(ref newSelection))
                    {
                        newSelection = TreeIter.Zero;
                    }
                }

                //new selection. Zeroing previousIter prevents trying to update name of deleted iter.
                previousIter = TreeIter.Zero;
                if (itemStore.IterIsValid(newSelection))
                {
                    itemTree.Selection.SelectIter(newSelection);
                }

                //and the removal and index update
                itemStore.Remove(ref iter);
                UpdateIndices(itemStore);
            };

            upButton.Clicked += delegate {
                TreeIter iter, prev;
                if (!itemTree.Selection.GetSelected(out iter))
                {
                    return;
                }

                //get previous iter
                prev = iter;
                if (!IterPrev(itemStore, ref prev))
                {
                    return;
                }

                //swap the two
                itemStore.Swap(iter, prev);

                //swap indices too
                object prevVal = itemStore.GetValue(prev, 1);
                object iterVal = itemStore.GetValue(iter, 1);
                itemStore.SetValue(prev, 1, iterVal);
                itemStore.SetValue(iter, 1, prevVal);
            };

            downButton.Clicked += delegate {
                TreeIter iter, next;
                if (!itemTree.Selection.GetSelected(out iter))
                {
                    return;
                }

                //get next iter
                next = iter;
                if (!itemStore.IterNext(ref next))
                {
                    return;
                }

                //swap the two
                itemStore.Swap(iter, next);

                //swap indices too
                object nextVal = itemStore.GetValue(next, 1);
                object iterVal = itemStore.GetValue(iter, 1);
                itemStore.SetValue(next, 1, iterVal);
                itemStore.SetValue(iter, 1, nextVal);
            };

            itemTree.Selection.Changed += delegate {
                TreeIter iter;
                if (!itemTree.Selection.GetSelected(out iter))
                {
                    removeButton.Sensitive = false;
                    return;
                }
                removeButton.Sensitive = true;

                //update grid
                object obj = itemStore.GetValue(iter, 0);
                grid.CurrentObject = obj;

                //update previously selected iter's name
                UpdateName(itemStore, previousIter);

                //update current selection so we can update
                //name next selection change
                previousIter = iter;
            };

            grid.Changed += delegate {
                TreeIter iter;
                if (itemTree.Selection.GetSelected(out iter))
                {
                    UpdateName(itemStore, iter);
                }
            };

            TreeIter selectionIter;
            removeButton.Sensitive = itemTree.Selection.GetSelected(out selectionIter);

            dialog.ShowAll();
            grid.ShowToolbar = false;

            #endregion

            //if 'OK' put items back in collection
            if (GtkExtensions.ShowCustomDialog(dialog, toplevel) == (int)ResponseType.Ok)
            {
                DesignerTransaction tran = CreateTransaction(Instance);
                object old = collection;

                try {
                    collection.Clear();
                    foreach (object[] o in itemStore)
                    {
                        collection.Add(o[0]);
                    }
                    EndTransaction(Instance, tran, old, collection, true);
                }
                catch {
                    EndTransaction(Instance, tran, old, collection, false);
                    throw;
                }
            }
        }
Beispiel #12
0
        public StatusDialog(string dialogTitle, ITranslationProvider translator)
        {
            this.translator = translator;
            lblCount        = new Label {
                UseMarkup = true
            };
            lblCount.SetText(translator.GetString("Generating..."));

            algProgress = new Alignment(0.5f, 0.5f, 1, 1)
            {
                LeftPadding  = 10,
                RightPadding = 10
            };
            algProgress.Add(lblCount);

            VBox da = new VBox {
                WidthRequest = 250
            };

            lblButtonText = new Label {
                Xalign = 1f, UseMarkup = true, Text = "<span size=\"small\">lblText</span>"
            };
            lblButtonText.Show();
            pgbCount = new ProgressBar();
            pgbCount.Show();

            #region Stop button setup

            Alignment algButtonIcon = new Alignment(0.5f, 0.5f, 1f, 1f)
            {
                ComponentHelper.LoadImage("Warehouse.Component.Printing.Icon.Cancel24.png")
            };

            HBox hboButton = new HBox {
                WidthRequest = 100
            };
            hboButton.PackStart(algButtonIcon, false, false, 0);
            hboButton.PackStart(lblButtonText, true, true, 0);

            Alignment algButton = new Alignment(0.5f, 0.5f, 0f, 0f)
            {
                hboButton
            };

            button = new Button {
                WidthRequest = 110, HeightRequest = 34
            };
            button.Add(algButton);
            button.Clicked += button_Clicked;

            #endregion

            dlgStatus = new Dialog {
                Title = dialogTitle
            };
            dlgStatus.VBox.PackStart(da, true, true, 0);
            dlgStatus.VBox.PackEnd(algProgress, true, true, 20);
            dlgStatus.AddActionWidget(button, ResponseType.Cancel);
            dlgStatus.DeleteEvent += dlgStatus_DeleteEvent;
            ButtonText             = translator.GetString("Cancel");
        }
Beispiel #13
0
        public override void LaunchDialogue()
        {
            //the Type in the collection
            IList  collection  = (IList)parentRow.PropertyValue;
            string displayName = parentRow.PropertyDescriptor.DisplayName;

            //populate list with existing items
            itemStore = new ListStore(typeof(object), typeof(int), typeof(string));
            for (int i = 0; i < collection.Count; i++)
            {
                itemStore.AppendValues(collection [i], i, collection [i].ToString());
            }

            #region Building Dialogue

            //dialogue and buttons
            Dialog dialog = new Dialog();
            dialog.Title       = displayName + " Editor";
            dialog.Modal       = true;
            dialog.AllowGrow   = true;
            dialog.AllowShrink = true;
            dialog.Modal       = true;
            dialog.AddActionWidget(new Button(Stock.Cancel), ResponseType.Cancel);
            dialog.AddActionWidget(new Button(Stock.Ok), ResponseType.Ok);

            //three columns for items, sorting, PropGrid
            HBox hBox = new HBox();
            dialog.VBox.PackStart(hBox, true, true, 5);

            //propGrid at end
            grid = new PropertyGrid(parentRow.ParentGrid.EditorManager);
            grid.CurrentObject = null;
            grid.WidthRequest  = 200;
            grid.ShowHelp      = false;
            hBox.PackEnd(grid, true, true, 5);

            //followed by item sorting buttons in ButtonBox
            VButtonBox sortButtonBox = new VButtonBox();
            sortButtonBox.LayoutStyle = ButtonBoxStyle.Start;
            Button upButton = new Button();
            Image  upImage  = new Image(Stock.GoUp, IconSize.Button);
            upImage.Show();
            upButton.Add(upImage);
            upButton.Show();
            sortButtonBox.Add(upButton);
            Button downButton = new Button();
            Image  downImage  = new Image(Stock.GoDown, IconSize.Button);
            downImage.Show();
            downButton.Add(downImage);
            downButton.Show();
            sortButtonBox.Add(downButton);
            hBox.PackEnd(sortButtonBox, false, false, 5);

            //Third column is a VBox
            VBox itemsBox = new VBox();
            hBox.PackStart(itemsBox, false, false, 5);

            //which at bottom has add/remove buttons
            HButtonBox addRemoveButtons = new HButtonBox();
            addRemoveButtons.LayoutStyle = ButtonBoxStyle.End;
            Button addButton = new Button(Stock.Add);
            addRemoveButtons.Add(addButton);
            if (types [0].IsAbstract)
            {
                addButton.Sensitive = false;
            }
            Button removeButton = new Button(Stock.Remove);
            addRemoveButtons.Add(removeButton);
            itemsBox.PackEnd(addRemoveButtons, false, false, 10);

            //and at top has list (TreeView) in a ScrolledWindow
            ScrolledWindow listScroll = new ScrolledWindow();
            listScroll.WidthRequest  = 200;
            listScroll.HeightRequest = 320;
            itemsBox.PackStart(listScroll, true, true, 0);

            itemTree = new TreeView(itemStore);
            itemTree.Selection.Mode = SelectionMode.Single;
            itemTree.HeadersVisible = false;
            listScroll.AddWithViewport(itemTree);

            //renderers and attribs for TreeView
            CellRenderer rdr = new CellRendererText();
            itemTree.AppendColumn(new TreeViewColumn("Index", rdr, "text", 1));
            rdr = new CellRendererText();
            itemTree.AppendColumn(new TreeViewColumn("Object", rdr, "text", 2));

            #endregion

            #region Events

            addButton.Clicked          += new EventHandler(addButton_Clicked);
            removeButton.Clicked       += new EventHandler(removeButton_Clicked);
            itemTree.Selection.Changed += new EventHandler(Selection_Changed);
            upButton.Clicked           += new EventHandler(upButton_Clicked);
            downButton.Clicked         += new EventHandler(downButton_Clicked);


            #endregion

            //show and get response
            dialog.ShowAll();
            ResponseType response = (ResponseType)dialog.Run();
            dialog.Destroy();

            //if 'OK' put items back in collection
            if (response == ResponseType.Ok)
            {
                DesignerTransaction tran = CreateTransaction(parentRow.ParentGrid.CurrentObject);
                object old = collection;

                try {
                    collection.Clear();
                    foreach (object[] o in itemStore)
                    {
                        collection.Add(o[0]);
                    }
                    EndTransaction(parentRow.ParentGrid.CurrentObject, tran, old, collection, true);
                }
                catch {
                    EndTransaction(parentRow.ParentGrid.CurrentObject, tran, old, collection, false);
                    throw;
                }
            }

            //clean up so we start fresh if launched again

            itemTree     = null;
            itemStore    = null;
            grid         = null;
            previousIter = TreeIter.Zero;
        }
Beispiel #14
0
    private void OnSignupEvent(Hashtable form)
    {
        if (((string)form["action"]).Equals("msg"))
        {
            new AlertDialog(this.MainWindow, AlertType.Info,
                            (string)form["title"],
                            (string)form["msg"]);
        }
        else
        {
            this.signupdata = form;

            Dialog dlg = new Dialog();
            dlg.Modal = true;
            dlg.Title = (string)form["title"];
            dlg.SetSizeRequest(500, -1);

            HBox split = new HBox();
            dlg.VBox.Add(split);
            VBox left  = new VBox(true, 0);
            VBox right = new VBox(true, 0);
            split.PackStart(left, false, false, 5);
            split.PackEnd(right, true, true, 10);

            NameValueCollection fields =
                (NameValueCollection)form["fields"];
            Hashtable data = (Hashtable)form["data"];

            foreach (string Key in fields.AllKeys)
            {
                Hashtable fd = (Hashtable)data[Key];

                string Name = Key.Substring(0, 1).ToUpper() +
                              Key.Substring(1) + ":";

                Label lbl = new Label(Name);
                lbl.SetAlignment(0, (float)0.5);
                left.PackStart(lbl, false, false, 5);

                if (fields[Key].Equals("TextEditView"))
                {
                    Entry ent = new Entry();
                    ent.Name             = Key;
                    ent.ActivatesDefault = true;
                    if (fd["isPassword"] != null)
                    {
                        ent.Visibility = false;
                    }
                    if (fd["value"] != null)
                    {
                        ent.Text = (string)fd["value"];
                    }
                    right.PackStart(ent, false, false, 5);
                }
                else if (fields[Key].Equals("PopupButtonView"))
                {
                    ComboBox cbox = ComboBox.NewText();
                    cbox.WrapWidth = 5;
                    cbox.Name      = Key;
                    if (fd["menuItems"] != null)
                    {
                        string menuItems = (string)fd["menuItems"];
                        foreach (string Value in menuItems.Split(','))
                        {
                            cbox.AppendText(Value);
                        }
                        if (fd["value"] != null &&
                            (string)fd["value"] != String.Empty)
                        {
                            cbox.Active = Convert.ToInt32(fd["value"]) - 1;
                        }
                        else
                        {
                            cbox.Active = 0;
                        }
                    }
                    right.PackStart(cbox, false, false, 5);
                }
                else if (fields[Key].Equals("ComboControlView"))
                {
                    ComboBoxEntry cboxe = ComboBoxEntry.NewText();
                    cboxe.WrapWidth = 5;
                    cboxe.Name      = Key;
                    if (fd["menuItems"] != null)
                    {
                        string menuItems = (string)fd["menuItems"];
                        foreach (string Value in menuItems.Split(','))
                        {
                            cboxe.AppendText(Value);
                        }
                    }
                    if (fd["value"] != null)
                    {
                        ((Entry)cboxe.Child).Text = (string)fd["value"];
                    }
                    right.PackStart(cboxe, false, false, 5);
                }
                else if (fields[Key].Equals("CheckboxView"))
                {
                    CheckButton cbtn = new CheckButton();
                    cbtn.Name = Key;
                    if (fd["value"] != null &&
                        (string)fd["value"] != String.Empty)
                    {
                        int v = Convert.ToInt32((string)fd["value"]);
                        cbtn.Active = v == 1;
                    }
                    right.PackStart(cbtn, false, false, 5);
                }
            }

            dlg.AddActionWidget(new Button("Cancel"),
                                ResponseType.Cancel);

            Button btn = new Button("Next");
            btn.CanDefault = true;
            dlg.AddActionWidget(btn, ResponseType.Ok);

            dlg.DefaultResponse = ResponseType.Ok;
            dlg.Response       += new ResponseHandler(OnSignupResponse);

            dlg.TransientFor = this.MainWindow;
            dlg.SetPosition(WindowPosition.CenterOnParent);

            dlg.ShowAll();

            if (form["redtext"] != null)
            {
                new AlertDialog(dlg, AlertType.Warning,
                                (string)form["title"],
                                (string)form["redtext"]);
            }
        }
    }