Example #1
0
 private void BrowseTargetFilename_Click(object sender, EventArgs e)
 {
     using (var dlg = DialogFactory.SaveFile())
     {
         dlg.Filter = string.Format(OSGeo.MapGuide.MaestroAPI.Strings.GenericFilter, OSGeo.MapGuide.MaestroAPI.Strings.PickMgp, "mgp"); //NOXLATE
         if (dlg.ShowDialog() == DialogResult.OK)
         {
             this.OutputFileName = dlg.FileName;
         }
     }
 }
Example #2
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     using (var diag = DialogFactory.SaveFile())
     {
         if (diag.ShowDialog() == DialogResult.OK)
         {
             System.IO.File.WriteAllText(diag.FileName, Results.Text);
             MessageService.ShowMessage(string.Format(Strings.Log_Saved, diag.FileName));
         }
     }
 }
 private void btnSave_Click(object sender, EventArgs e)
 {
     using (var save = DialogFactory.SaveFile())
     {
         save.Filter = string.Format(OSGeo.MapGuide.MaestroAPI.Strings.GenericFilter, OSGeo.MapGuide.MaestroAPI.Strings.PickLog, "log"); //NOXLATE
         if (save.ShowDialog() == DialogResult.OK)
         {
             File.WriteAllText(save.FileName, txtMessages.Text);
             MessageService.ShowMessage(string.Format(Strings.Log_Saved, save.FileName));
         }
     }
 }
 private void btnSave_Click(object sender, EventArgs e)
 {
     using (var diag = DialogFactory.SaveFile())
     {
         if (diag.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             using (var sw = new StreamWriter(diag.FileName, false))
             {
                 sw.WriteLine("========== ERROR DETAILS =========\n");    //NOXLATE
                 sw.WriteLine(_ex.ToString());
                 sw.WriteLine("\n========== XML CONTENT ==========\n\n"); //NOXLATE
                 sw.WriteLine(txtXmlContent.Text);
                 sw.Close();
             }
         }
     }
 }
Example #5
0
        private void btnExport_Click(object sender, EventArgs e)
        {
            if (grdCommands.SelectedRows.Count == 0)
            {
                MessageBox.Show(Strings.ExportNoCommandsSelected);
                return;
            }
            else
            {
                List <string> selectedCmds = new List <string>();
                foreach (DataGridViewRow row in grdCommands.SelectedRows)
                {
                    var cmd     = ((CommandDecorator)row.DataBoundItem).DecoratedInstance;
                    var cmdType = cmd.GetType();
                    if (typeof(IInvokeScriptCommand).IsAssignableFrom(cmdType))
                    {
                        selectedCmds.Add(cmd.Name);
                    }
                    else if (typeof(IInvokeUrlCommand).IsAssignableFrom(cmdType))
                    {
                        selectedCmds.Add(cmd.Name);
                    }
                    else if (typeof(ISearchCommand).IsAssignableFrom(cmdType))
                    {
                        selectedCmds.Add(cmd.Name);
                    }
                }

                if (selectedCmds.Count == 0)
                {
                    MessageBox.Show(Strings.ExportNoCustomCommandsSelected);
                    return;
                }

                using (var save = DialogFactory.SaveFile())
                {
                    save.Filter = string.Format(OSGeo.MapGuide.MaestroAPI.Strings.GenericFilter, OSGeo.MapGuide.MaestroAPI.Strings.PickXml, "xml"); //NOXLATE
                    if (save.ShowDialog() == DialogResult.OK)
                    {
                        _wl.ExportCustomCommands(save.FileName, selectedCmds.ToArray());
                        MessageBox.Show(string.Format(Strings.CustomCommandsExported, save.FileName));
                    }
                }
            }
        }
Example #6
0
 private void btnSaveDownList_Click(object sender, EventArgs e)
 {
     using (var save = DialogFactory.SaveFile())
     {
         save.Filter = string.Format(OSGeo.MapGuide.MaestroAPI.Strings.GenericFilter, OSGeo.MapGuide.MaestroAPI.Strings.PickTxt, "txt"); //NOXLATE
         if (save.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             if (chkIncludeSelected.Checked)
             {
                 System.IO.File.WriteAllLines(save.FileName, _selResources.Concat(_downlist));
             }
             else
             {
                 System.IO.File.WriteAllLines(save.FileName, _downlist);
             }
         }
     }
 }
Example #7
0
        private void btnDownload_Click(object sender, EventArgs e)
        {
            var item = this.SelectedItem;

            if (item != null)
            {
                using (var save = DialogFactory.SaveFile())
                {
                    save.FileName = item.Name;
                    if (save.ShowDialog() == DialogResult.OK)
                    {
                        var fn = save.FileName;
                        try
                        {
                            //TODO: Obviously support progress
                            BusyWaitDelegate method = () =>
                            {
                                IResource res    = _edSvc.GetEditedResource();
                                var       stream = _edSvc.CurrentConnection.ResourceService.GetResourceData(res.ResourceID, item.Name);
                                using (var fs = File.OpenWrite(fn))
                                {
                                    Utility.CopyStream(stream, fs);
                                }
                                return(null);
                            };
                            BusyWaitDialog.Run(Strings.TextDownloading, method, (obj, ex) =>
                            {
                                if (ex != null)
                                {
                                    throw ex;
                                }
                                MessageBox.Show(string.Format(Strings.FileDownloaded, fn));
                            });
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(NestedExceptionMessageProcessor.GetFullMessage(ex), Strings.TitleError, MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
            }
        }
        public override void Run()
        {
            var wb      = Workbench.Instance;
            var exp     = wb.ActiveSiteExplorer;
            var connMgr = ServiceRegistry.GetService <ServerConnectionManager>();
            var conn    = connMgr.GetConnection(exp.ConnectionName);

            if (exp.SelectedItems.Length == 1)
            {
                using (var diag = DialogFactory.SaveFile())
                {
                    if (diag.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        var res = conn.ResourceService.GetResource(exp.SelectedItems[0].ResourceId);
                        System.IO.File.WriteAllText(diag.FileName, res.Serialize());
                        MessageService.ShowMessage(string.Format(Strings.SavedResource, diag.FileName));
                    }
                }
            }
        }