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


C# IProgressStatus.SetMessage方法代码示例

本文整理汇总了C#中IProgressStatus.SetMessage方法的典型用法代码示例。如果您正苦于以下问题:C# IProgressStatus.SetMessage方法的具体用法?C# IProgressStatus.SetMessage怎么用?C# IProgressStatus.SetMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IProgressStatus的用法示例。


在下文中一共展示了IProgressStatus.SetMessage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LoadAddin

        internal bool LoadAddin(IProgressStatus statusMonitor, string id, bool throwExceptions)
        {
            try {
                if (IsAddinLoaded (id))
                    return true;

                if (!Registry.IsAddinEnabled (id)) {
                    string msg = GettextCatalog.GetString ("Disabled add-ins can't be loaded.");
                    ReportError (msg, id, null, false);
                    if (throwExceptions)
                        throw new InvalidOperationException (msg);
                    return false;
                }

                ArrayList addins = new ArrayList ();
                Stack depCheck = new Stack ();
                ResolveLoadDependencies (addins, depCheck, id, false);
                addins.Reverse ();

                if (statusMonitor != null)
                    statusMonitor.SetMessage ("Loading Addins");

                for (int n=0; n<addins.Count; n++) {

                    if (statusMonitor != null)
                        statusMonitor.SetProgress ((double) n / (double)addins.Count);

                    Addin iad = (Addin) addins [n];
                    if (IsAddinLoaded (iad.Id))
                        continue;

                    if (statusMonitor != null)
                        statusMonitor.SetMessage (string.Format(GettextCatalog.GetString("Loading {0} add-in"), iad.Id));

                    if (!InsertAddin (statusMonitor, iad))
                        return false;
                }
                return true;
            }
            catch (Exception ex) {
                ReportError ("Add-in could not be loaded: " + ex.Message, id, ex, false);
                if (statusMonitor != null)
                    statusMonitor.ReportError ("Add-in '" + id + "' could not be loaded.", ex);
                if (throwExceptions)
                    throw;
                return false;
            }
        }
开发者ID:slluis,项目名称:mono-addins,代码行数:48,代码来源:AddinEngine.cs

示例2: MonitorProcessStatus

		public static void MonitorProcessStatus (IProgressStatus monitor, TextReader reader, StringCollection progessLog)
		{
			string line;
			string exceptionText = null;
			while ((line = reader.ReadLine ()) != null) {
				int i = line.IndexOf (':');
				if (i != -1) {
					string tag = line.Substring (0, i);
					string txt = line.Substring (i+1);
					bool wasTag = true;
					
					switch (tag) {
						case "process-ps-msg":
							monitor.SetMessage (Decode (txt));
							break;
						case "process-ps-progress":
							monitor.SetProgress (double.Parse (txt));
							break;
						case "process-ps-log":
							monitor.Log (Decode (txt));
							break;
						case "process-ps-warning":
							monitor.ReportWarning (Decode (txt));
							break;
						case "process-ps-exception":
							exceptionText = Decode (txt);
							if (exceptionText == string.Empty)
								exceptionText = null;
							break;
						case "process-ps-error":
							string err = Decode (txt);
							if (err == string.Empty) err = null;
							monitor.ReportError (err, exceptionText != null ? new Exception (exceptionText) : null);
							break;
						case "process-ps-cancel":
							monitor.Cancel ();
							break;
						case "process-ps-plog":
							progessLog.Add (Decode (txt));
							break;
						default:
							wasTag = false;
							break;
					}
					if (wasTag)
						continue;
				}
				Console.WriteLine (line);
			}
		}
开发者ID:wanglehui,项目名称:mono-addins,代码行数:50,代码来源:ProcessProgressStatus.cs


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