当前位置: 首页>>代码示例>>C#>>正文


C# Client.ResPath类代码示例

本文整理汇总了C#中DigitalPlatform.rms.Client.ResPath的典型用法代码示例。如果您正苦于以下问题:C# ResPath类的具体用法?C# ResPath怎么用?C# ResPath使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ResPath类属于DigitalPlatform.rms.Client命名空间,在下文中一共展示了ResPath类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Clone

 public ResPath Clone()
 {
     ResPath newobj = new ResPath();
     newobj.Url = this.Url;
     newobj.Path = this.Path;
     return newobj;
 }
开发者ID:renyh1013,项目名称:dp2,代码行数:7,代码来源:ResPath.cs

示例2: SaveRecord

		// 保存记录
		// parameters:
		//		strRecordPath	记录路径。如果==null,表示直接用textBox_recPath中当前的内容作为路径
		public void SaveRecord(string strRecordPath)
		{
			if (strRecordPath != null)
				textBox_recPath.Text = strRecordPath;

			if (textBox_recPath.Text == "")
			{
				MessageBox.Show(this, "路径不能为空");
				return;
			}

			ResPath respath = new ResPath(textBox_recPath.Text);

			Uri uri = null;
			try 
			{
				uri = new Uri(respath.Url);
			}
			catch (Exception ex)
			{
				MessageBox.Show(this, "路径错误: " + ex.Message);
				return;
			}
			// 保存到文件
			if (uri.IsFile)
			{
				MessageBox.Show(this, "暂时不支持保存到文件");
				return;
			}


			string strError;

			string strXml = "";
            bool bHasUploadedFile = false;

			int nRet = GetXmlRecord(out strXml,
                out bHasUploadedFile,
                out strError);
			if (nRet == -1)
			{
				MessageBox.Show(this, strError);
				return;
			}


			byte [] baOutputTimeStamp = null;
			string strOutputPath = "";
			long lRet = 0;

            int nUploadCount = 0;

			// 使用Channel
			RmsChannel channelSave = channel;

			channel = Channels.GetChannel(respath.Url);
			Debug.Assert(channel != null, "Channels.GetChannel 异常");

			try 
			{

                stop.OnStop += new StopEventHandler(this.DoStop);
				stop.Initial("正在保存记录 " + respath.FullPath);
				stop.BeginLoop();


				EnableControlsInLoading(true);

				//string strTemp = ByteArray.GetHexTimeStampString(this.TimeStamp);

                if (String.IsNullOrEmpty(this.strDatabaseOriginPath) == false
                    && bHasUploadedFile == true
                    && respath.FullPath != this.strDatabaseOriginPath)
                {
                    ResPath respath_old = new ResPath(this.strDatabaseOriginPath);

                    if (respath_old.Url != respath.Url)
                    {
                        MessageBox.Show(this, "目前暂不支持跨服务器情况下的资源复制。本记录中原有的已上载资源,在另存到目标库的时丢失(为空),请注意保存完后手动上载。");
                        goto SKIPCOPYRECORD;
                    }
                    // 复制记录
                    // return:
                    //		-1	出错。错误信息在strError中
                    //		0或者其他		成功
                    nRet = channel.DoCopyRecord(respath_old.Path,
                        respath.Path,
                        false,  // bool bDeleteOriginRecord,
                        out baOutputTimeStamp,
                        out strOutputPath,
                        out strError);
                    if (nRet == -1)
                    {
                        MessageBox.Show(this, "复制资源时发生错误: " + strError);
                    }
                    else
                    {
//.........这里部分代码省略.........
开发者ID:paopaofeng,项目名称:dp2,代码行数:101,代码来源:DetailForm.cs

示例3: GetDefaultProjectName

        // 获得一个发起库对应的缺省查重方案名
        int GetDefaultProjectName(string strFromDbFullPath,
            out string strDefaultProjectName,
            out string strError)
        {
            strDefaultProjectName = "";
            strError = "";

            if (this.domDupCfg == null)
            {
                strError = "配置文件dom尚未初始化";
                return -1;
            }

            ResPath respath = new ResPath(strFromDbFullPath);


            XmlNode node = this.domDupCfg.SelectSingleNode("//default[@origin='" + strFromDbFullPath + "']");
            if (node == null)
            {
                node = this.domDupCfg.SelectSingleNode("//default[@origin='" + respath.Path + "']");
            }

            if (node == null)
                return 0;	// not found

            strDefaultProjectName = DomUtil.GetAttr(node, "project");

            return 1;
        }
开发者ID:renyh1013,项目名称:dp2,代码行数:30,代码来源:DupDlg.cs

示例4: DownloadFilesToLocalDir

		public int DownloadFilesToLocalDir(out string strError)
		{
			strError = "";

			// 列出所有文件
						
			Debug.Assert(this.Container != null, "");

			m_nDownloading ++;

			try 
			{

				ResPath respath = new ResPath(this.ServerPath);

                RmsChannel channel = this.Container.Channels.GetChannel(respath.Url);

				Debug.Assert(channel != null, "Channels.GetChannel() 异常");

				string [] items = null;
			
				long lRet = channel.DoDir(respath.Path,
					"zh",
                    null,   // 不需要返回所有语言的名字
					ResTree.RESTYPE_FILE,
					out items,
					out strError);
				if (lRet == -1)
					return -1;

				this.Names = items;
				Container.Changed = true;

				for(int i=0;i<items.Length;i++)
				{
					string strName = items[i];

					string strServerPath = respath.Path + "/" + strName;

					byte[] baTimeStamp = null;
					string strOutputPath;
					string strMetaData;

					// string strStyle = "attachment,data,timestamp,outputpath";

					string strLocalFileName = this.LocalPath + "/" + strName;

					lRet = channel.GetRes(
						strServerPath,
						strLocalFileName,
						null,	// stop
						out strMetaData,
						out baTimeStamp,
						out strOutputPath,
						out strError);
					if (lRet == -1)
						return -1;


				}


				return 0;
			}
			finally 
			{
				m_nDownloading --;
			}
		}
开发者ID:paopaofeng,项目名称:dp2,代码行数:69,代码来源:LinkInfo.cs

示例5: menuItem_importTemplate_Click

        // 导入模板
        void menuItem_importTemplate_Click(object sender, System.EventArgs e)
        {
            if (treeView_res.SelectedNode == null)
            {
                MessageBox.Show("请选择一个节点");
                return;
            }

            if (treeView_res.SelectedNode.ImageIndex != ResTree.RESTYPE_SERVER)
            {
                MessageBox.Show("请选择一个服务器类型节点");
                return;
            }

            ResPath respath = new ResPath(treeView_res.SelectedNode);

            /*
            string strRefDbName = "";
            if (treeView_res.SelectedNode != null)
            {
                if (respath.Path != "")
                {
                    string strPath = respath.Path;
                    strRefDbName = StringUtil.GetFirstPartPath(ref strPath);
                }
            }
             */


            OpenFileDialog filedlg = new OpenFileDialog();

            filedlg.FileName = "*.template";
			// filedlg.InitialDirectory = Environment.CurrentDirectory;
			filedlg.Filter = "模板文件 (*.template)|*.template|All files (*.*)|*.*" ;
			filedlg.RestoreDirectory = true ;

			if (filedlg.ShowDialog() != DialogResult.OK)
			{
				return;
			}


            ImportTemplateDlg dlg = new ImportTemplateDlg();
            MainForm.SetControlFont(dlg, this.DefaultFont);

            dlg.Url = respath.Url;
            dlg.FileName = filedlg.FileName;
            dlg.MainForm = this;
            dlg.ShowDialog(this);
        }
开发者ID:renyh1013,项目名称:dp2,代码行数:51,代码来源:MainForm.cs

示例6: menuItem_deleteObject_Click

        private void menuItem_deleteObject_Click(object sender, System.EventArgs e)
		{
            try
            {
                string strError = "";

                if (treeView_res.SelectedNode == null)
                {
                    MessageBox.Show("请选择一个数据库、目录或文件节点");
                    return;
                }

                ResPath respath = new ResPath(treeView_res.SelectedNode);

                string strPath = "";
                if (respath.Path != "")
                {
                    strPath = respath.Path;
                    // strPath = StringUtil.GetFirstPartPath(ref strPath);
                }
                else
                {
                    // Debug.Assert(false, "");
                    MessageBox.Show("请选择一个数据库、目录或文件节点");
                    return;
                }

                string strText = "";

                if (treeView_res.SelectedNode.ImageIndex == ResTree.RESTYPE_DB)
                    strText = "确实要删除位于 " + respath.Url + "\r\n的数据库 '" + strPath + "' ?\r\n\r\n***警告:数据库一旦删除,就无法恢复。";
                else
                    strText = "确实要删除位于 " + respath.Url + "\r\n的对象 '" + strPath + "' ?\r\n\r\n***警告:对象一旦删除,就无法恢复。";

                //
                DialogResult result = MessageBox.Show(this,
                    strText,
                    "dp2manager",
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Question,
                    MessageBoxDefaultButton.Button2);
                if (result != DialogResult.Yes)
                    return;

                RmsChannel channel = Channels.GetChannel(respath.Url);
                if (channel == null)
                {
                    strError = "Channels.GetChannel 异常";
                    goto ERROR1;
                }

                long lRet = 0;

                if (treeView_res.SelectedNode.ImageIndex == ResTree.RESTYPE_DB)
                {
                    // 删除数据库
                    lRet = channel.DoDeleteDB(strPath, out strError);
                }
                else
                {
                    byte[] timestamp = null;
                    byte[] output_timestamp = null;

                REDODELETE:
                    // 删除其他资源
                    lRet = channel.DoDeleteRes(strPath,
                        timestamp,
                        out output_timestamp,
                        out strError);
                    if (lRet == -1 && channel.ErrorCode == ChannelErrorCode.TimestampMismatch)
                    {
                        timestamp = output_timestamp;
                        goto REDODELETE;
                    }
                }

                if (lRet == -1)
                    goto ERROR1;

                if (treeView_res.SelectedNode.ImageIndex == ResTree.RESTYPE_DB)
                    MessageBox.Show(this, "数据库 '" + strPath + "' 已被成功删除");
                else
                    MessageBox.Show(this, "对象 '" + strPath + "' 已被成功删除");



                this.treeView_res.Refresh(ResTree.RefreshStyle.All);

                return;
            ERROR1:
                MessageBox.Show(this, strError);
                return;
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, "menuItem_deleteObject_Click() 抛出异常: " + ExceptionUtil.GetDebugText(ex));
            }
		}
开发者ID:renyh1013,项目名称:dp2,代码行数:98,代码来源:MainForm.cs

示例7: menuItem_databaseManagement_Click

		private void menuItem_databaseManagement_Click(object sender, System.EventArgs e)
		{
			if (treeView_res.SelectedNode == null)
			{
				MessageBox.Show("请选择一个数据库节点");
				return;
			}

			ResPath respath = new ResPath(treeView_res.SelectedNode);
			if (respath.Path == "")
			{
				MessageBox.Show("请选择一个数据库类型的节点");
				return;
			}
			string strPath = respath.Path;
			string strDbName = StringUtil.GetFirstPartPath(ref strPath);
			if (strDbName == "")
			{
				MessageBox.Show("错误: 数据库名为空");
				return;
			}

			DatabaseDlg dlg = new DatabaseDlg();
            MainForm.SetControlFont(dlg, this.DefaultFont);
            dlg.StartPosition = FormStartPosition.CenterScreen;
			dlg.MainForm = this;
			dlg.Initial(respath.Url, 
                strDbName);

			this.AppInfo.LinkFormState(dlg, "databasedlg_state");
			dlg.ShowDialog(this);
			this.AppInfo.UnlinkFormState(dlg);
		}
开发者ID:renyh1013,项目名称:dp2,代码行数:33,代码来源:MainForm.cs

示例8: treeView_res_AfterSelect

		private void treeView_res_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e)
		{
			if (treeView_res.SelectedNode == null)
			{
                this.toolStripStatusLabel_main.Text = "尚未选择一个节点";
				return;
			}

			ResPath respath = new ResPath(treeView_res.SelectedNode);

            this.toolStripStatusLabel_main.Text = "当前节点: " + respath.FullPath;
		
		}
开发者ID:renyh1013,项目名称:dp2,代码行数:13,代码来源:MainForm.cs

示例9: AutoGenerate

		// 自动加工数据
		public void AutoGenerate()
		{
			// 库名部分路径
			ResPath respath = new ResPath(textBox_recPath.Text);
			respath.MakeDbName();

			string strError;
			string strCode;
			string strRef;

			// 使用Channel
			RmsChannel channelSave = channel;

			channel = Channels.GetChannel(respath.Url);
			Debug.Assert(channel != null, "Channels.GetChannel 异常");

			try 
			{
				string strCfgPath = respath.Path + "/cfgs/autoGenerate.cs";

				string strCfgRefPath = respath.Path + "/cfgs/autoGenerate.cs.ref";

                stop.OnStop += new StopEventHandler(this.DoStop);
                stop.Initial("正在下载文件" + strCfgPath);
				stop.BeginLoop();

				byte[] baTimeStamp = null;
				string strMetaData;
				string strOutputPath;

				long lRet = channel.GetRes(
					MainForm.cfgCache,
					strCfgPath,
					out strCode,
					out strMetaData,
					out baTimeStamp,
					out strOutputPath,
					out strError);

				stop.EndLoop();
                stop.OnStop -= new StopEventHandler(this.DoStop);
				stop.Initial("");

				if (lRet == -1) 
				{
					MessageBox.Show(this, strError);
					return;
				}


                stop.OnStop += new StopEventHandler(this.DoStop);
                stop.Initial("正在下载文件" + strCfgRefPath);
				stop.BeginLoop();

				lRet = channel.GetRes(
					MainForm.cfgCache,
					strCfgRefPath,
					out strRef,
					out strMetaData,
					out baTimeStamp,
					out strOutputPath,
					out strError);

				stop.EndLoop();
                stop.OnStop -= new StopEventHandler(this.DoStop);
				stop.Initial("");


				if (lRet == -1) 
				{
					MessageBox.Show(this, strError);
					return;
				}

			}
			finally 
			{
				channel = channelSave;
			}



			// 执行代码
			int nRet = RunScript(strCode,
                strRef,
                out strError);
			if (nRet == -1) 
			{
				MessageBox.Show(this, strError);
				return;
			}

		}
开发者ID:paopaofeng,项目名称:dp2,代码行数:94,代码来源:DetailForm.cs

示例10: SaveToBackup

		// 保存到备份格式
		public void SaveToBackup(string strOutputFileName)
		{
			string strError;

			// 询问文件名
			if (strOutputFileName == null)
			{
				SaveFileDialog dlg = new SaveFileDialog();

				dlg.Title = "请指定要保存的备份文件名";
				dlg.CreatePrompt = false;
				dlg.OverwritePrompt = false;
                dlg.FileName = MainForm.UsedBackupFileName;  // "*.dp2bak";
				dlg.InitialDirectory = Environment.CurrentDirectory;
				dlg.Filter = "backup files (*.dp2bak)|*.dp2bak|All files (*.*)|*.*" ;

				dlg.RestoreDirectory = true;

				if(dlg.ShowDialog() != DialogResult.OK)
					return;

				strOutputFileName = dlg.FileName;
                MainForm.UsedBackupFileName = strOutputFileName;    // 记忆下来
			}

            bool bOverwrite = false;

            if (File.Exists(strOutputFileName) == true)
            {
                OverwriteOrAppendBackupFileDlg dlg = new OverwriteOrAppendBackupFileDlg();
                dlg.Font = GuiUtil.GetDefaultFont();

                dlg.Text = "文件已经存在,是否覆盖?";
                dlg.Message = "文件 " + strOutputFileName + " 已经存在,是追加还是覆盖?";
                dlg.ShowDialog(this);

                if (dlg.DialogResult == DialogResult.Yes)
                {
                    // 追加
                    bOverwrite = false;
                }
                else if (dlg.DialogResult == DialogResult.No)
                {
                    // 覆盖
                    bOverwrite = true;
                }
                return; // 放弃
            }

			// 打开文件

			FileStream fileTarget = File.Open(
				strOutputFileName,
				FileMode.OpenOrCreate,	// 原来是Open,后来修改为OpenOrCreate。这样对临时文件被系统管理员手动意外删除(但是xml文件中仍然记载了任务)的情况能够适应。否则会抛出FileNotFoundException异常
				FileAccess.Write,
				FileShare.ReadWrite);

            if (bOverwrite == true)
                fileTarget.SetLength(0);

			try 
			{

				fileTarget.Seek(0, SeekOrigin.End);	// 具有追加的能力

				long lStart = fileTarget.Position;	// 记忆起始位置

				byte [] length = new byte[8];

				fileTarget.Write(length, 0, 8);	// 临时写点数据,占据记录总长度位置

                bool bHasUploadedFile = false;


				// 获得Xml记录
				string strXmlBody;	
				int nRet = GetXmlRecord(out strXmlBody,
                    out bHasUploadedFile,
                    out strError);
				if (nRet == -1)
				{
					fileTarget.SetLength(lStart);	// 把本次追加写入的全部去掉
					goto ERROR1;
				}

				ResPath respath = new ResPath(textBox_recPath.Text);

				// 向backup文件中保存第一个 res
				ExportUtil.ChangeMetaData(ref this.m_strMetaData, // ResFileList
					null,
					null,
					null,
					null,
					respath.FullPath,
					ByteArray.GetHexTimeStampString(this.TimeStamp));   // 任延华加 2005/6/11

				long lRet = Backup.WriteFirstResToBackupFile(
					fileTarget,
					this.m_strMetaData,
//.........这里部分代码省略.........
开发者ID:paopaofeng,项目名称:dp2,代码行数:101,代码来源:DetailForm.cs

示例11: DownloadOneFileMetaData

		// 回调函数
		int DownloadOneFileMetaData(string strID,
			out string strResultXml,
			out byte[] timestamp,
			out string strError)
		{
			timestamp = null;
			strError = "";
			ResPath respath = new ResPath(textBox_recPath.Text);
			string strResPath = respath.Path + "/object/" + strID;

			strResPath = strResPath.Replace(":", "/");

			// 使用Channel

			RmsChannel channelSave = channel;

			channel = Channels.GetChannel(respath.Url);
			Debug.Assert(channel != null, "Channels.GetChannel 异常");

			try 
			{

                stop.OnStop += new StopEventHandler(this.DoStop);
                stop.Initial("正在下载资源文件的元数据 " + strResPath);
				stop.BeginLoop();

				byte [] baOutputTimeStamp = null;
				string strOutputPath = "";

				EnableControlsInLoading(true);

				// 只得到metadata
				long lRet = channel.GetRes(strResPath,
					(Stream)null,
					stop,
					"metadata,timestamp,outputpath",
					null,
					out strResultXml,
					out baOutputTimeStamp,
					out strOutputPath,
					out strError);

				EnableControlsInLoading(false);

				stop.EndLoop();
                stop.OnStop -= new StopEventHandler(this.DoStop);
				stop.Initial("");


				if (lRet == -1) 
				{
					MessageBox.Show(this, "下载资源文件元数据失败,原因: "+strError);
					goto ERROR1;
				}

				timestamp = baOutputTimeStamp;

			}
			finally 
			{
				channel = channelSave;
			}
			return 0;

			ERROR1:
			return -1;
		}
开发者ID:paopaofeng,项目名称:dp2,代码行数:68,代码来源:DetailForm.cs

示例12: DownloadOneFile

		int DownloadOneFile(string strID,
			out string strError)
		{

			strError = "";
			ResPath respath = new ResPath(textBox_recPath.Text);
			string strResPath = respath.Path + "/object/" + strID;

			strResPath = strResPath.Replace(":", "/");


			string strLocalPath = this.listView_resFiles.GetLocalFileName(strID);

			SaveFileDialog dlg = new SaveFileDialog();

			dlg.Title = "请指定要保存的本地文件名";
			dlg.CreatePrompt = false;
			dlg.FileName = strLocalPath == "" ? strID + ".res" : strLocalPath;
			dlg.InitialDirectory = Environment.CurrentDirectory;
			// dlg.Filter = "projects files (outer*.xml)|outer*.xml|All files (*.*)|*.*" ;

			dlg.RestoreDirectory = true ;

			if(dlg.ShowDialog() != DialogResult.OK)
			{
				strError = "放弃";
				return -1;
			}


			// 使用Channel
			RmsChannel channelSave = channel;

			channel = Channels.GetChannel(respath.Url);
			Debug.Assert(channel != null, "Channels.GetChannel 异常");

			try 
			{

                stop.OnStop += new StopEventHandler(this.DoStop);
                stop.Initial("正在下载资源文件 " + strResPath);
				stop.BeginLoop();

				byte [] baOutputTimeStamp = null;

				EnableControlsInLoading(true);

				string strMetaData;
				string strOutputPath = "";

				long lRet = channel.GetRes(strResPath,
					dlg.FileName,
					stop,
					out strMetaData,
					out baOutputTimeStamp,
					out strOutputPath,
					out strError);

				EnableControlsInLoading(false);

				stop.EndLoop();
                stop.OnStop -= new StopEventHandler(this.DoStop);
				stop.Initial("");


				if (lRet == -1) 
				{
					MessageBox.Show(this, "下载资源文件失败,原因: "+strError);
					goto ERROR1;
				}

			}
			finally 
			{
				channel = channelSave;
			}
			return 0;

			ERROR1:
			return -1;

		}
开发者ID:paopaofeng,项目名称:dp2,代码行数:82,代码来源:DetailForm.cs

示例13: SearchDup

		// 启动查重
		// parameters:
		//		strRecordPath	记录路径。如果==null,表示直接用textBox_recPath中当前的内容作为路径
		public void SearchDup(string strRecordPath)
		{
			if (strRecordPath == null || strRecordPath == "")
				strRecordPath = textBox_recPath.Text;

			if (strRecordPath == "")
			{
				MessageBox.Show(this, "必须指定好路径后, 才能进行查重");
				return;
			}

			ResPath respath = new ResPath(strRecordPath);

			string strError;

			string strXml = "";
            bool bHasUploadedFile = false;

			int nRet = GetXmlRecord(out strXml, 
                out bHasUploadedFile,
                out strError);
			if (nRet == -1)
			{
				MessageBox.Show(this, strError);
				return;
			}


			// 最好激活当前已经存在的查重mdi窗口

			DupDlg dlg = new DupDlg();
            dlg.Font = GuiUtil.GetDefaultFont();

			// dlg.TopMost = true;
			dlg.OpenDetail -= new OpenDetailEventHandler(this.MainForm.OpenDetailCallBack);
			dlg.OpenDetail += new OpenDetailEventHandler(this.MainForm.OpenDetailCallBack);
			dlg.Closed -= new EventHandler(dupdlg_Closed);
			dlg.Closed += new EventHandler(dupdlg_Closed);

			SearchPanel searchpanel = new SearchPanel();
			searchpanel.Initial(this.MainForm.Servers,
				this.MainForm.cfgCache);

			searchpanel.ap = this.MainForm.AppInfo;
			searchpanel.ApCfgTitle = "detailform_dupdlg";

			string strDbFullName = respath.Url + "?" + ResPath.GetDbName(respath.Path);
			// 获得上次遗留的缺省查重方案名
			string strDupProjectName = GetUsedDefaultDupProject(strDbFullName);

			dlg.Initial(searchpanel,
				respath.Url,
				true);
			dlg.ProjectName = strDupProjectName;
			dlg.RecordFullPath = strRecordPath;
			dlg.Record = strXml;
			dlg.MdiParent = this.MainForm;	// MDI化
			dlg.Show();



			// this.MainForm.SetFirstMdiWindowState();
		}
开发者ID:paopaofeng,项目名称:dp2,代码行数:66,代码来源:DetailForm.cs

示例14: ViewAccessPoint

		// 观察检索点
		// parameters:
		//		strRecordPath	记录路径。如果==null,表示直接用textBox_recPath中当前的内容作为路径
		public void ViewAccessPoint(string strRecordPath)
		{
			if (strRecordPath == null || strRecordPath == "")
				strRecordPath = textBox_recPath.Text;

			if (strRecordPath == "")
			{
				MessageBox.Show(this, "必须指定好路径后, 才能模拟创建检索点");
				return;
			}

			ResPath respath = new ResPath(strRecordPath);

			string strError;

			string strXml = "";

			// 使用Channel
			RmsChannel channelSave = channel;

			channel = Channels.GetChannel(respath.Url);
			Debug.Assert(channel != null, "Channels.GetChannel 异常");

			try 
			{
                bool bHasUploadedFile = false;

				int nRet = GetXmlRecord(out strXml, 
                    out bHasUploadedFile,
                    out strError);
				if (nRet == -1)
				{
					MessageBox.Show(this, strError);
					return;
				}
			}
			finally 
			{
				channel = channelSave;
			}

            ViewAccessPointForm accessPointWindow = MainForm.TopViewAccessPointForm;

            if (accessPointWindow == null)
            {
                accessPointWindow = new ViewAccessPointForm();
                // accessPointWindow.StartPosition = FormStartPosition.CenterScreen;
                accessPointWindow.Show();
                accessPointWindow.MdiParent = MainForm; // MDI子窗口
            }
            else
                accessPointWindow.Activate();

                /*
			else 
			{
				accessPointWindow.Focus();
				if (accessPointWindow.WindowState == FormWindowState.Minimized) 
				{
					accessPointWindow.WindowState = FormWindowState.Normal;
				}
			}
                 */

            /*
			if (accessPointWindow.Visible == false) 
			{
				try // Close()过的窗口
				{
					accessPointWindow.Show();
				}
				catch (System.ObjectDisposedException)
				{
					accessPointWindow = new ViewAccessPointForm();
					accessPointWindow.StartPosition = FormStartPosition.CenterScreen;
					accessPointWindow.Show();
				}
			}
             */


			// 使用Channel
			channelSave = channel;

			channel = Channels.GetChannel(respath.Url);
			Debug.Assert(channel != null, "Channels.GetChannel 异常");

			try 
			{
                stop.OnStop += new StopEventHandler(this.DoStop);
				stop.Initial("正在获取检索点 " + respath.FullPath);
				stop.BeginLoop();


				EnableControlsInLoading(true);

				long lRet = channel.DoGetKeys(
//.........这里部分代码省略.........
开发者ID:paopaofeng,项目名称:dp2,代码行数:101,代码来源:DetailForm.cs

示例15: DeleteRecord

		// 删除记录
		// parameters:
		//		strRecordPath	记录路径。如果==null,表示直接用textBox_recPath中当前的内容作为路径
		public void DeleteRecord(string strRecordPath)
		{
			if (strRecordPath != null)
				textBox_recPath.Text = strRecordPath;

			if (textBox_recPath.Text == "")
			{
				MessageBox.Show(this, "路径不能为空");
				return;
			}

			ResPath respath = new ResPath(textBox_recPath.Text);

			Uri uri = null;
			try 
			{
				uri = new Uri(respath.Url);
			}
			catch (Exception ex)
			{
				MessageBox.Show(this, "路径错误: " + ex.Message);
				return;
			}			// 保存到文件
			if (uri.IsFile)
			{
				MessageBox.Show(this, "暂时不支持删除文件");
				return;
			}


			string strText = "你确实要删除位于服务器 '"+respath.Url+"' 上的记录 '"+respath.Path + "' 吗?";

			DialogResult msgResult = MessageBox.Show(this,
				strText,
				"dp2rms",
				MessageBoxButtons.OKCancel,
				MessageBoxIcon.Question,
				MessageBoxDefaultButton.Button2);
				
			if (msgResult != DialogResult.OK) 
			{
				MessageBox.Show(this, "删除操作被放弃...");
				return;
			}

			string strError;
			byte [] baOutputTimeStamp = null;

			// 使用Channel
			RmsChannel channelSave = channel;

			channel = Channels.GetChannel(respath.Url);
			Debug.Assert(channel != null, "Channels.GetChannel 异常");

			try 
			{

                stop.OnStop += new StopEventHandler(this.DoStop);
                stop.Initial("正在删除记录 " + respath.FullPath);
				stop.BeginLoop();


				EnableControlsInLoading(true);

				long lRet = channel.DoDeleteRes(respath.Path,
					this.TimeStamp,
					out baOutputTimeStamp,
					out strError);

				EnableControlsInLoading(false);

				stop.EndLoop();
                stop.OnStop -= new StopEventHandler(this.DoStop);
				stop.Initial("");

				if (lRet == -1) 
				{
					MessageBox.Show(this, "删除记录 '"+respath.Path+"' 失败,原因: "+strError);
					return;
				}

			}
			finally
			{
				channel = channelSave;
			}



			// 如果删除成功,原来时间戳遗留在this.TimeStamp中,也无害

			MessageBox.Show(this, "删除记录 '" + respath.FullPath + "' 成功。");

		}
开发者ID:paopaofeng,项目名称:dp2,代码行数:97,代码来源:DetailForm.cs


注:本文中的DigitalPlatform.rms.Client.ResPath类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。