• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Client.ResPath类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: menuItem_newAccount_Click

        // 新建帐户
        void menuItem_newAccount_Click(object sender, System.EventArgs e)
        {

            if (treeView_res.SelectedNode == null)
            {
                MessageBox.Show("请选择一个节点");
                return;
            }

            ResPath respath = new ResPath(treeView_res.SelectedNode);

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

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


示例17: menuItem_linkLocalDir_Click

		// 关联本地目录
		private void menuItem_linkLocalDir_Click(object sender, System.EventArgs e)
		{
			string strDefault = "";
			if (treeView_res.SelectedNode != null)
			{
				ResPath respath = new ResPath(treeView_res.SelectedNode);


				if (treeView_res.SelectedNode.ImageIndex == ResTree.RESTYPE_FOLDER)
					strDefault = respath.FullPath;
				else
					strDefault = respath.Url;
			}


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

			dlg.LinkInfos = this.LinkInfos;
			dlg.CreateNewServerPath = strDefault;
			dlg.ShowDialog(this);
		}
开发者ID:renyh1013,项目名称:dp2,代码行数:23,代码来源:MainForm.cs


示例18: GetOnePinyin

		// 获得一个汉字的拼音
		// 所获得的拼音, 是一个分号间隔的字符串, 表示对应于这个汉字的多音
		// return:
		//		-1	error
		//		1	found
		//		0	not found
		int GetOnePinyin(string strOneHanzi,
			out string strPinyin,
			out string strError)
		{
			strPinyin = "";
			strError = "";

			// 拼音库路径
			string strPinyinDbPath = MainForm.AppInfo.GetString("pinyin",
				"pinyin_db_path",
				"");

            if (String.IsNullOrEmpty(strPinyinDbPath) == true)
            {
                strError = "拼音库路径尚未配置。请先用菜单“帮助/系统参数设置”功能配置适当的拼音库路径。";
                return -1;
            }

			ResPath respath = new ResPath(strPinyinDbPath);

			string strDbName = respath.Path;

            // 2007/4/5 改造 加上了 GetXmlStringSimple()
			string strQueryXml = "<target list='" + strDbName + ":" + "汉字'><item><word>"
				+ StringUtil.GetXmlStringSimple(strOneHanzi)
                + "</word><match>exact</match><relation>=</relation><dataType>string</dataType><maxCount>10</maxCount></item><lang>chi</lang></target>";

			// 使用Channel
			RmsChannel channelSave = channel;

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

			try 
			{

                stop.OnStop += new StopEventHandler(this.DoStop);
                stop.Initial("正在检索拼音 '" + strOneHanzi + "'");
				stop.BeginLoop();

				try 
				{

					long nRet = channel.DoSearch(strQueryXml,
                        "default",
                        out strError);
					if (nRet == -1) 
					{
						strError = "检索拼音库时出错: " + strError;
						return -1;
					}
					if (nRet == 0)
						return 0;	// not found

					List<string> aPath = null;
					nRet = channel.DoGetSearchResult(
                        "default",
						1,
						this.Lang,
						stop,
						out aPath,
						out strError);
					if (nRet == -1) 
					{
						strError = "检索拼音库获取检索结果时出错: " + strError;
						return -1;
					}

					if (aPath.Count == 0)
					{
						strError = "检索拼音库获取的检索结果为空";
						return -1;
					}

					string strStyle = "content,data";

					string strContent;
					string strMetaData;
					byte[] baTimeStamp;
					string strOutputPath;

					nRet = channel.GetRes((string)aPath[0],
						strStyle,
						// this.eventClose,
						out strContent,
						out strMetaData,
						out baTimeStamp,
						out strOutputPath,
						out strError);
					if (nRet == -1) 
					{
						strError = "获取拼音记录体时出错: " + strError;
						return -1;
					}
//.........这里部分代码省略.........
开发者ID:paopaofeng,项目名称:dp2,代码行数:101,代码来源:DetailForm.cs


示例19: menuItem_accountManagement_Click

		private void menuItem_accountManagement_Click(object sender, System.EventArgs e)
		{

			if (treeView_res.SelectedNode == null)
			{
				MessageBox.Show("请选择一个节点");
				return;
			}

			ResPath respath = new ResPath(treeView_res.SelectedNode);

			GetUserNameDlg namedlg = new GetUserNameDlg();
            MainForm.SetControlFont(namedlg, this.DefaultFont);

			string strError = "";
            this.Cursor = Cursors.WaitCursor;
            int nRet = namedlg.Initial(this.Servers,
				this.Channels,
				this.stopManager,
				respath.Url,
				out strError);
            this.Cursor = Cursors.Arrow;
            if (nRet == -1)
			{
				MessageBox.Show(strError);
				return;
			}

			namedlg.StartPosition = FormStartPosition.CenterScreen;
			namedlg.ShowDialog(this);
			if (namedlg.DialogResult != DialogResult.OK)
				return;

			UserRightsDlg dlg = new UserRightsDlg();
            MainForm.SetControlFont(dlg, this.DefaultFont);
            dlg.StartPosition = FormStartPosition.CenterScreen;
			dlg.UserName = namedlg.SelectedUserName;
            dlg.UserRecPath = namedlg.SelectedUserRecPath;
			dlg.ServerUrl = respath.Url;
			dlg.MainForm = this;

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


示例20: MarcEditor_GetConfigFile

        int m_nInGetCfgFile = 0;    // 防止GetCfgFile()函数重入 2008/3/6

        // marc编辑窗要从外部获得配置文件内容
        private void MarcEditor_GetConfigFile(object sender,
            DigitalPlatform.Marc.GetConfigFileEventArgs e)
        {

            if (m_nInGetCfgFile > 0)
            {
                e.ErrorInfo = "MarcEditor_GetConfigFile() 重入了";
                return;
            }

            if (String.IsNullOrEmpty(textBox_recPath.Text))
            {
                e.ErrorInfo = "URL为空";
                return;
            }

            // 下载配置文件
            ResPath respath = new ResPath(textBox_recPath.Text);

            string strCfgFileName = e.Path;
            int nRet = strCfgFileName.IndexOf("#");
            if (nRet != -1)
            {
                strCfgFileName = strCfgFileName.Substring(0, nRet);
            }

            string strPath = ResPath.GetDbName(respath.Path) + "/cfgs/" + strCfgFileName;

            // 使用Channel

            RmsChannel channelSave = channel;

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

            m_nInGetCfgFile++;

            try
            {

                string strContent;
                string strError;

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

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

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

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


                if (lRet == -1)
                {
                    if (channel.ErrorCode == ChannelErrorCode.NotFound)
                    {
                        e.ErrorInfo = "";
                        return;
                    }


                    e.ErrorInfo = "获得配置文件 '" + strPath + "' 时出错:" + strError;
                    return;
                }
                else
                {
                    byte[] baContent = StringUtil.GetUtf8Bytes(strContent, true);
                    MemoryStream stream = new MemoryStream(baContent);
                    e.Stream = stream;
                }


            }
            finally
            {
                channel = channelSave;

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



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Client.RmsChannel类代码示例发布时间:2022-05-24
下一篇:
C# DigitalPlatform.Stop类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap