Пример #1
0
        private async void cmdGetID_Click(object sender, EventArgs e)
        {
            frmGetCloudFileID frmGet = new frmGetCloudFileID();

            cmdGetID.Enabled = false;
            if (frmGet.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                Cloud_Elements_API.CloudElementsConnector.TraceLevel diagTraceWas = Cloud_Elements_API.CloudElementsConnector.DiagOutputLevel;
                try
                {
                    TestStatusMsg("Checking: " + frmGet.FileID);
                    Cloud_Elements_API.CloudFile CloudFileInfoByID;
                    Cloud_Elements_API.CloudElementsConnector.DiagOutputLevel = Cloud_Elements_API.CloudElementsConnector.TraceLevel.All;
                    CloudFileInfoByID = await Cloud_Elements_API.FileOperations.GetCloudFileInfo(APIConnector, Cloud_Elements_API.CloudElementsConnector.FileSpecificationType.ID, frmGet.FileID);

                    if (CloudFileInfoByID == null)
                    {
                        StatusMsg("Nothing Returned!  (not expecting not found)");
                    }
                    else
                    {
                        if (CloudFileInfoByID.directory)
                        {
                            txtFolderPath.Text = CloudFileInfoByID.path;
                        }
                        else
                        {
                            txtFolderPath.Text = CloudFileInfoByID.path.Substring(0, CloudFileInfoByID.path.LastIndexOf("/"));
                        }
                        TestStatusMsg("Getting: " + CloudFileInfoByID.path);
                        Task refresh = RefreshCurrentFolder();

                        await refresh;
                        //dgFolderContents.SelectedRows.Clear();
                        foreach (DataGridViewRow gridRow in dgFolderContents.Rows)
                        {
                            Cloud_Elements_API.CloudFile itemrow = (Cloud_Elements_API.CloudFile)gridRow.DataBoundItem;
                            if (itemrow.id == frmGet.FileID)
                            {
                                gridRow.Selected             = true;
                                dgFolderContents.CurrentCell = dgFolderContents.Rows[gridRow.Index].Cells[0];
                                break;
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    StatusMsg(string.Format("FAILED: {0}", ex.Message));
                }
                finally
                {
                    Cloud_Elements_API.CloudElementsConnector.DiagOutputLevel = diagTraceWas;
                }
            }
            cmdGetID.Enabled = true;
        }
Пример #2
0
        private async void cmdGetFN_click(object sender, EventArgs e)
        {
            frmGetCloudFileID frmGet = new frmGetCloudFileID();

            frmGet.SetFNMode();
            cmdGetFN.Enabled = false;
            if (frmGet.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                Cloud_Elements_API.CloudElementsConnector.TraceLevel diagTraceWas = Cloud_Elements_API.CloudElementsConnector.DiagOutputLevel;
                try
                {
                    TestStatusMsg("Checking: " + frmGet.FileID);
                    Cloud_Elements_API.CloudFile CloudFileInfoByID;
                    Cloud_Elements_API.CloudElementsConnector.DiagOutputLevel = Cloud_Elements_API.CloudElementsConnector.TraceLevel.All;
                    CloudFileInfoByID = await Cloud_Elements_API.FileOperations.GetCloudFileInfo(APIConnector, Cloud_Elements_API.CloudElementsConnector.FileSpecificationType.Path, frmGet.FileID);

                    if (CloudFileInfoByID == null)
                    {
                        StatusMsg("Nothing Returned!  (not expecting not found)");
                    }
                    else
                    {
                        if (CloudFileInfoByID.directory)
                        {
                            txtFolderPath.Text = CloudFileInfoByID.path;
                        }
                        else
                        {
                            txtFolderPath.Text = CloudFileInfoByID.path.Substring(0, CloudFileInfoByID.path.LastIndexOf("/"));
                        }
                        TestStatusMsg("Getting: " + CloudFileInfoByID.path);
                        Task refresh = RefreshCurrentFolder();
                    }
                }
                catch (Exception ex)
                {
                    StatusMsg(string.Format("FAILED: {0}", ex.Message));
                }
                finally
                {
                    Cloud_Elements_API.CloudElementsConnector.DiagOutputLevel = diagTraceWas;
                    cmdGetFN.Enabled = true;
                }
            }
        }