예제 #1
0
        public void OkDialog()
        {
            if (treeViewFolders.SelectedNode == null || treeViewFolders.SelectedNode.Level == 0)
            {
                // Prompt the user to select a folder if no node is selected or only the top-level node
                // (the server name) is selected.
                MessageDlg.Show(this, Resources.PublishDocumentDlg_OkDialog_Please_select_a_folder);
                return;
            }

            FolderInformation folderInfo = treeViewFolders.SelectedNode.Tag as FolderInformation;

            if (folderInfo == null)
            {
                MessageDlg.Show(this, Resources.PublishDocumentDlg_UploadSharedZipFile_Error_obtaining_server_information);
                return;
            }
            if (!folderInfo.HasWritePermission)
            {
                MessageDlg.Show(this, Resources.PublishDocumentDlg_UploadSharedZipFile_You_do_not_have_permission_to_upload_to_the_given_folder);
                return;
            }

            if (!PanoramaPublishClient.ServerSupportsSkydVersion(folderInfo, _docContainer, this))
            {
                return;
            }

            DialogResult = DialogResult.OK;
        }
예제 #2
0
        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)));
            }
        }
예제 #3
0
        public void Upload(Control parent)
        {
            string            folderPath  = GetFolderPath(treeViewFolders.SelectedNode);
            var               zipFilePath = tbFilePath.Text;
            FolderInformation folderInfo  = treeViewFolders.SelectedNode.Tag as FolderInformation;

            if (folderInfo != null)
            {
                PanoramaPublishClient.UploadSharedZipFile(parent, folderInfo.Server, zipFilePath, folderPath);
            }
        }
예제 #4
0
        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)));
            }
        }
예제 #5
0
        public void OkDialog()
        {
            if (treeViewFolders.SelectedNode == null || treeViewFolders.SelectedNode.Level == 0)
            {
                // Prompt the user to select a folder if no node is selected or only the top-level node
                // (the server name) is selected.
                MessageDlg.Show(this, Resources.PublishDocumentDlg_OkDialog_Please_select_a_folder);
                return;
            }

            FolderInformation folderInfo = treeViewFolders.SelectedNode.Tag as FolderInformation;

            if (folderInfo == null)
            {
                MessageDlg.Show(this, Resources.PublishDocumentDlg_UploadSharedZipFile_Error_obtaining_server_information);
                return;
            }
            if (!folderInfo.HasWritePermission)
            {
                MessageDlg.Show(this, Resources.PublishDocumentDlg_UploadSharedZipFile_You_do_not_have_permission_to_upload_to_the_given_folder);
                return;
            }

            try
            {
                ShareType = PanoramaPublishClient.DecideShareType(folderInfo, _docContainer.DocumentUI);
            }
            catch (PanoramaServerException panoramaServerException)
            {
                MessageDlg.ShowWithException(this, panoramaServerException.Message, panoramaServerException);
                return;
            }

            Assume.IsNotNull(ShareType);
            DialogResult = DialogResult.OK;
        }