Пример #1
0
        static void saveButton_Clicked(object sender, EventArgs e)
        {
            FileChooserDialog fcd = new FileChooserDialog("Save page as...", (Window)((Widget)sender).Toplevel, FileChooserAction.Save);

            fcd.AddButton(Stock.Cancel, ResponseType.Cancel);
            fcd.AddButton(Stock.Save, ResponseType.Ok);
            fcd.DefaultResponse = ResponseType.Ok;
            fcd.Filter          = new FileFilter();
            fcd.Filter.AddPattern("*.aspx");
            fcd.SelectMultiple = false;
            fcd.SetFilename(((System.Web.UI.Control)host.RootComponent).ID + ".aspx");

            ResponseType response = (ResponseType)fcd.Run();

            fcd.Hide();

            if (response == ResponseType.Ok && fcd.Filename != null)
            {
                using (FileStream fileStream = new FileStream(fcd.Filename, FileMode.Create))
                {
                    if (fileStream == null)
                    {
                        return;
                    }
                    host.SaveDocument(fileStream);
                }
            }
            fcd.Destroy();
        }