Пример #1
0
 public Task(TaskType type, HTTPAgent.FileType fileType, long fileId, string fileTitle)
 {
     mType = type;
     mFileType = fileType;
     mFileId = fileId;
     mFileTitle = fileTitle;
 }
Пример #2
0
 void ChannelSettingManagementForm_onRemoveFileFailed(HTTPAgent.FileType type, long fid, string title, System.Net.HttpStatusCode statusCode)
 {
     MessageBox.Show("Remove " + type.ToString() + " file '" + title + "' failed, status code = " + statusCode.ToString());
 }
Пример #3
0
        void ChannelSettingManagementForm_onUploadFileSuccessfully(HTTPAgent.FileType type, WatsEMIAnalyzer.Bindings.FileDescription description, byte[] parseData)
        {
            DataCenter.Instance().ChannelSettings[description.ID] = Utility.Deserailize<List<ChannelSetting>>(parseData);
            DataCenter.Instance().ChannelSettingDescriptions[description.ID] = description;
            ChannelSettingList.Items.Add(description);
            ViewButton.Enabled = RemoveButton.Enabled = (ChannelSettingList.SelectedItems.Count > 0);

            ChannelSettingDetailForm detailForm = new ChannelSettingDetailForm(DataCenter.Instance().ChannelSettings[description.ID]);
            detailForm.ShowDialog();
        }
Пример #4
0
        void ChannelSettingManagementForm_onRemoveFileSuccessfully(HTTPAgent.FileType type, long fid, string title)
        {
            if (DataCenter.Instance().ChannelSettings.ContainsKey(fid))
            {
                ChannelSettingList.Items.Remove(DataCenter.Instance().ChannelSettingDescriptions[fid]);
                DataCenter.Instance().ChannelSettings.Remove(fid);
                DataCenter.Instance().ChannelSettingDescriptions.Remove(fid);
            }

            ViewButton.Enabled = RemoveButton.Enabled = (ChannelSettingList.SelectedItems.Count > 0);
        }
Пример #5
0
        void LoadDataForm_onGetFileListSuccessfully(HTTPAgent.FileType type, FileList fileList)
        {
            if (fileList != null && fileList.Description != null)
            {
                for (int i = fileList.Description.Count - 1; i >= 0; i--)
                {
                    switch (type)
                    {
                        case HTTPAgent.FileType.channelSetting:
                            DataCenter.Instance().ChannelSettingDescriptions[fileList.Description[i].ID] = fileList.Description[i];
                            break;

                        case HTTPAgent.FileType.equipmentParameter:
                            DataCenter.Instance().EquipmentParameterDescriptions[fileList.Description[i].ID] = fileList.Description[i];
                            break;

                        case HTTPAgent.FileType.linkconfiguration:
                            DataCenter.Instance().LinkConfigurationDescriptions[fileList.Description[i].ID] = fileList.Description[i];
                            break;

                        case HTTPAgent.FileType.emi:
                            DataCenter.Instance().EMIDescriptions[fileList.Description[i].ID] = fileList.Description[i];
                            break;
                    }

                    if (type != HTTPAgent.FileType.emi)
                    {
                        mTaskStack.Push(new Task(TaskType.getFile, type, fileList.Description[i].ID, fileList.Description[i].Title));
                    }
                }
            }

            ExecuteTask();
        }
Пример #6
0
 void LoadDataForm_onGetFileListFailed(HTTPAgent.FileType type, System.Net.HttpStatusCode statusCode)
 {
     MessageBox.Show("Can't download " + type.ToString() + " file list !");
     ExecuteTask();
 }
Пример #7
0
        void LoadDataForm_onDownloadFileSuccessfully(HTTPAgent.FileType type, long fid, string title, HTTPAgent.DownloadType downloadType, byte[] content)
        {
            switch(type)
            {
                case HTTPAgent.FileType.channelSetting:
                    DataCenter.Instance().ChannelSettings[fid] = Utility.Deserailize <List<ChannelSetting>>(content);
                    break;

                case HTTPAgent.FileType.colorSetting:
                    break;

                case HTTPAgent.FileType.equipmentParameter:
                    DataCenter.Instance().EquipmentParameters[fid] = Utility.Deserailize<Dictionary<string, EquipmentParameter>>(content);
                    break;

                case HTTPAgent.FileType.linkconfiguration:
                    DataCenter.Instance().LinkConfigurations[fid] = Utility.Deserailize<List<LinkConfiguration>>(content);
                    break;

                case HTTPAgent.FileType.emi:
                    DataCenter.Instance().EMIs[fid] = Utility.Deserailize<EMIFileData>(content);
                    break;
            }

            ExecuteTask();
        }
Пример #8
0
        void LoadDataForm_onDownloadFileFailed(HTTPAgent.FileType type, long fid, string title, HTTPAgent.DownloadType downloadType, System.Net.HttpStatusCode statusCode)
        {
            switch (type)
            {
                case HTTPAgent.FileType.channelSetting:
                    if (DataCenter.Instance().ChannelSettingDescriptions.ContainsKey(fid))
                        DataCenter.Instance().ChannelSettingDescriptions.Remove(fid);
                    break;

                case HTTPAgent.FileType.colorSetting:
                    break;

                case HTTPAgent.FileType.equipmentParameter:
                    if (DataCenter.Instance().EquipmentParameterDescriptions.ContainsKey(fid))
                        DataCenter.Instance().EquipmentParameterDescriptions.Remove(fid);
                    break;

                case HTTPAgent.FileType.linkconfiguration:
                    if (DataCenter.Instance().LinkConfigurationDescriptions.ContainsKey(fid))
                        DataCenter.Instance().LinkConfigurationDescriptions.Remove(fid);
                    break;
            }

            MessageBox.Show("Can't download " + type.ToString() + " file '" + title + "', status code = " + statusCode.ToString());
            ExecuteTask();
        }
        void LinkConfigurationManagementForm_onRemoveFileSuccessfully(HTTPAgent.FileType type, long fid, string title)
        {
            if (DataCenter.Instance().LinkConfigurations.ContainsKey(fid))
            {
                LinkConfigurationList.Items.Remove(DataCenter.Instance().LinkConfigurationDescriptions[fid]);
                DataCenter.Instance().LinkConfigurations.Remove(fid);
                DataCenter.Instance().LinkConfigurationDescriptions.Remove(fid);
            }

            OKButton.Enabled = ViewButton.Enabled = RemoveButton.Enabled = (LinkConfigurationList.SelectedItems.Count > 0);
        }
Пример #10
0
 public static HTTPAgent instance()
 {
     if (mHTTPAgent == null)
     {
         mHTTPAgent = new HTTPAgent();
     }
     return mHTTPAgent;
 }
Пример #11
0
        void UploadEMIProgressForm_onUploadFileSuccessfully(HTTPAgent.FileType type,FileDescription description, byte[] parseData)
        {
            Debug.WriteLine("Upload emi file '" + mCurUploadFile + "' succeed !");
            DetailListBox.Items.Add(description.FileName);
            DetailListBox.Items.Add(" Succeed !");

            RemoveEmiFile(mCurUploadFile);

            mEmiFileCount++;
            mUploadSucceedCount++;
            UpdateStatusInfo();
            UpdateProgress(mEmiFileCount, mCurUploadFile);

            DataCenter.Instance().UploadFiles.Remove(mCurUploadFile);
            DataCenter.Instance().StoreData();

            if (OnEmiFileUploadHandler != null)
            {
                EMIFileData emi = Utility.Deserailize<EMIFileData>(parseData);
                OnEmiFileUploadHandler(emi);
            }

            if (mIsTerminated)
                return;

            UploadEmiFile();
        }
        void EquipmentParameterManagementForm_onUploadFileSuccessfully(HTTPAgent.FileType type, WatsEMIAnalyzer.Bindings.FileDescription description, byte[] parseData)
        {
            DataCenter.Instance().EquipmentParameters[description.ID] = Utility.Deserailize<Dictionary<string, EquipmentParameter>>(parseData);
            DataCenter.Instance().EquipmentParameterDescriptions[description.ID] = description;
            EquipmentParameterList.Items.Add(description);
            ViewButton.Enabled = RemoveButton.Enabled = (EquipmentParameterList.SelectedItems.Count > 0);

            EquipmentParameterDetailForm detailForm = new EquipmentParameterDetailForm(DataCenter.Instance().EquipmentParameters[description.ID]);
            detailForm.ShowDialog();
        }
 void EquipmentParameterManagementForm_onRemoveFileSuccessfully(HTTPAgent.FileType type, long fid, string title)
 {
     if (DataCenter.Instance().EquipmentParameters.ContainsKey(fid))
     {
         EquipmentParameterList.Items.Remove(DataCenter.Instance().EquipmentParameterDescriptions[fid]);
         DataCenter.Instance().EquipmentParameters.Remove(fid);
         DataCenter.Instance().EquipmentParameterDescriptions.Remove(fid);
     }
     ViewButton.Enabled = RemoveButton.Enabled = (EquipmentParameterList.SelectedItems.Count > 0);
 }