private void PublishDocumentDlgLoad(List <KeyValuePair <Server, JToken> > listServerFolders) { if (PanoramaPublishClient == null) { PanoramaPublishClient = new WebPanoramaPublishClient(); } var listErrorServers = new List <Server>(); foreach (var server in _panoramaServers) { JToken folders = null; try { folders = PanoramaPublishClient.GetInfoForFolders(server, null); } catch (WebException) { listErrorServers.Add(server); } listServerFolders.Add(new KeyValuePair <Server, JToken>(server, folders)); } if (listErrorServers.Count > 0) { throw new Exception(TextUtil.LineSeparate(Resources.PublishDocumentDlg_PublishDocumentDlgLoad_Failed_attempting_to_retrieve_information_from_the_following_servers_, string.Empty, ServersToString(listErrorServers))); } }
private void PublishDocumentDlgLoad(List <KeyValuePair <Server, JToken> > listServerFolders) { if (PanoramaPublishClient == null) { PanoramaPublishClient = new WebPanoramaPublishClient(); } var listErrorServers = new List <Tuple <Server, string> >(); foreach (var server in _panoramaServers) { JToken folders = null; try { folders = PanoramaPublishClient.GetInfoForFolders(server, null); } catch (Exception ex) { if (ex is WebException || ex is PanoramaServerException) { var error = ex.Message; if (Resources .EditServerDlg_OkDialog_The_username_and_password_could_not_be_authenticated_with_the_panorama_server .Equals(error)) { error = TextUtil.LineSeparate(error, Resources .PublishDocumentDlg_PublishDocumentDlgLoad_Go_to_Tools___Options___Panorama_tab_to_update_the_username_and_password_); } listErrorServers.Add(new Tuple <Server, string>(server, error)); } else { throw; } } listServerFolders.Add(new KeyValuePair <Server, JToken>(server, folders)); } if (listErrorServers.Count > 0) { throw new Exception(TextUtil.LineSeparate(Resources.PublishDocumentDlg_PublishDocumentDlgLoad_Failed_attempting_to_retrieve_information_from_the_following_servers_, string.Empty, ServersToString(listErrorServers))); } }
private void PublishDocToPanorama(Server panoramaServer, string zipFilePath, string panoramaFolder) { var waitBroker = new CommandProgressMonitor(_statusWriter, new ProgressStatus(Resources.PanoramaPublishHelper_PublishDocToPanorama_Publishing_document_to_Panorama)); IPanoramaPublishClient publishClient = new WebPanoramaPublishClient(); try { publishClient.SendZipFile(panoramaServer, panoramaFolder, zipFilePath, waitBroker); } catch (Exception x) { var panoramaEx = x.InnerException as PanoramaImportErrorException ?? x as PanoramaImportErrorException; if (panoramaEx == null) { _statusWriter.WriteLine(Resources.PanoramaPublishHelper_PublishDocToPanorama_, x.Message); } else { _statusWriter.WriteLine( Resources.PanoramaPublishHelper_PublishDocToPanorama_An_error_occurred_on_the_Panorama_server___0___importing_the_file_, panoramaEx.ServerUrl); _statusWriter.WriteLine( Resources.PanoramaPublishHelper_PublishDocToPanorama_Error_details_can_be_found_at__0_, panoramaEx.JobUrl); } } }
public void ShowPublishDlg(IPanoramaPublishClient publishClient) { if (publishClient == null) publishClient = new WebPanoramaPublishClient(); var document = DocumentUI; if (!document.IsLoaded) { MessageDlg.Show(this, Resources.SkylineWindow_publishToolStripMenuItem_Click_The_document_must_be_fully_loaded_before_it_can_be_published); return; } string fileName = DocumentFilePath; if (string.IsNullOrEmpty(fileName)) { if (MessageBox.Show(this, Resources.SkylineWindow_publishToolStripMenuItem_Click_The_document_must_be_saved_before_it_can_be_published, Program.Name, MessageBoxButtons.OKCancel) == DialogResult.Cancel) return; if (!SaveDocumentAs()) return; fileName = DocumentFilePath; } if (!SaveDocument()) return; var servers = Settings.Default.ServerList; if (servers.Count == 0) { DialogResult buttonPress = MultiButtonMsgDlg.Show( this, TextUtil.LineSeparate( Resources.SkylineWindow_ShowPublishDlg_There_are_no_Panorama_servers_to_publish_to, Resources.SkylineWindow_ShowPublishDlg_Press_Register_to_register_for_a_project_on_PanoramaWeb_, Resources.SkylineWindow_ShowPublishDlg_Press_Continue_to_use_the_server_of_your_choice_), Resources.SkylineWindow_ShowPublishDlg_Register, Resources.SkylineWindow_ShowPublishDlg_Continue, true); if (buttonPress == DialogResult.Cancel) return; object tag = null; if (buttonPress == DialogResult.Yes) { // person intends to register WebHelpers.OpenLink(this, "http://proteome.gs.washington.edu/software/Skyline/panoramaweb-signup.html"); // Not L10N tag = true; } var serverPanoramaWeb = new Server(PanoramaUtil.PANORAMA_WEB, string.Empty, string.Empty); var newServer = servers.EditItem(this, serverPanoramaWeb, null, tag); if (newServer == null) return; servers.Add(newServer); } var panoramaSavedUri = document.Settings.DataSettings.PanoramaPublishUri; var showPublishDocDlg = true; // if the document has a saved uri prompt user for acton, check servers, and permissions, then publish // if something fails in the attempt to publish to the saved uri will bring up the usual PublishDocumentDlg if (panoramaSavedUri != null && !string.IsNullOrEmpty(panoramaSavedUri.ToString())) { showPublishDocDlg = !PublishToSavedUri(publishClient, panoramaSavedUri, fileName, servers); } // if no uri was saved to publish to or user chose to view the dialog show the dialog if (showPublishDocDlg) { using (var publishDocumentDlg = new PublishDocumentDlg(this, servers, fileName)) { publishDocumentDlg.PanoramaPublishClient = publishClient; if (publishDocumentDlg.ShowDialog(this) == DialogResult.OK) { if (ShareDocument(publishDocumentDlg.FileName, false)) publishDocumentDlg.Upload(this); } } } }
private void PublishDocumentDlgLoad(List<KeyValuePair<Server, JToken>> listServerFolders) { if (PanoramaPublishClient == null) PanoramaPublishClient = new WebPanoramaPublishClient(); var listErrorServers = new List<Server>(); foreach (var server in _panoramaServers) { JToken folders = null; try { folders = PanoramaPublishClient.GetInfoForFolders(server, null); } catch (WebException) { listErrorServers.Add(server); } listServerFolders.Add(new KeyValuePair<Server, JToken>(server, folders)); } if (listErrorServers.Count > 0) { throw new Exception(TextUtil.LineSeparate(Resources.PublishDocumentDlg_PublishDocumentDlgLoad_Failed_attempting_to_retrieve_information_from_the_following_servers_, string.Empty, ServersToString(listErrorServers))); } }