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


C# Lookup.Notify方法代码示例

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


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

示例1: HandleFrameResult

 private void HandleFrameResult(object result)
 {
     if (result is Frame)
     {
         var lookup = new Lookup(task_master, null, new[] {"value"}, ((Frame) result).Context);
         lookup.Notify(HandleFinalResult);
     }
 }
开发者ID:davidhankins,项目名称:flabbergast,代码行数:8,代码来源:test-harness.cs

示例2: Run

        protected override bool Run()
        {
            if (mappings.Count == 0) {
                interlock = categories.Count + 2;
                Computation input_lookup = new Lookup(master, source_reference, new []{"arg"}, context);
                input_lookup.Notify(input_result => {
                    if (input_result is Stringish) {
                        input = input_result.ToString();
                        if (Interlocked.Decrement(ref interlock) == 0) {
                            master.Slot(this);
                        }
                    } else {
                        master.ReportOtherError(source_reference, "Input argument must be a string.");
                    }
                });
                master.Slot(input_lookup);

                foreach (var entry in categories) {
                    var lookup = new Lookup(master, source_reference, new []{ entry.Value }, context);
                    lookup.Notify(cat_result => {
                        mappings[entry.Key] = cat_result;
                        if (Interlocked.Decrement(ref interlock) == 0) {
                            master.Slot(this);
                        }
                    });
                    master.Slot(lookup);
                }

                if (Interlocked.Decrement(ref interlock) > 0) {
                    return false;
                }
            }
            var frame = new Frame(master, master.NextId(), source_reference, context, container);
            for(int it = 0; it < input.Length; it++) {
                frame[TaskMaster.OrdinalNameStr(it + 1)] = mappings[Char.GetUnicodeCategory(input[it])];
            }
            result = frame;
            return true;
        }
开发者ID:brian-brazil,项目名称:flabbergast,代码行数:39,代码来源:misc.cs

示例3: HandleFrameResult

 private void HandleFrameResult(object result)
 {
     var frame = result as Frame;
     if (frame != null) {
         var lookup = new Lookup(task_master, new SourceReference("printer", "<native>", 0, 0, 0, 0, null), new[] {"value"}, frame.Context);
         lookup.Notify(HandleFinalResult);
         task_master.Slot(lookup);
     } else {
         Console.Error.WriteLine("File did not contain a frame. That should be impossible.");
     }
 }
开发者ID:brian-brazil,项目名称:flabbergast,代码行数:11,代码来源:library-runtime.cs

示例4: Run

        protected override bool Run()
        {
            if (input == null) {
                Computation input_lookup = new Lookup(task_master, source_reference, new []{"arg"}, context);
                input_lookup.Notify(input_result => {
                    if (input_result is Stringish) {
                        input = input_result.ToString();
                        if (Interlocked.Decrement(ref interlock) == 0) {
                            task_master.Slot(this);
                        }
                    } else {
                        task_master.ReportOtherError(source_reference, "Input argument must be a string.");
                    }
                });

                if (Interlocked.Decrement(ref interlock) > 0) {
                    return false;
                }
            }
            var frame = new MutableFrame(task_master, source_reference, context, container);
            for(int it = 0; it < input.Length; it++) {
                frame.Set(it + 1, (long) Char.ConvertToUtf32(input, it));
            }
            result = frame;
            return true;
        }
开发者ID:davidhankins,项目名称:flabbergast,代码行数:26,代码来源:misc.cs

示例5: LookupString

 void LookupString(Frame frame, string name, ConsumeString consume)
 {
     var lookup = new Lookup(task_master, source_ref, new []{name}, Context.Prepend(frame, null));
     lookup.Notify(result => {
         if (result is Stringish) {
             var str = result.ToString();
             consume(str);
         } else {
             task_master.ReportOtherError(source_ref, String.Format("Expected “{0}” to be a string. Got {1} instead.", name, Stringish.NameForType(result.GetType())));
         }
     });
 }
开发者ID:davidhankins,项目名称:flabbergast,代码行数:12,代码来源:misc.cs

示例6: HandleTransformation

 private void HandleTransformation(object result)
 {
     if (result is Frame) {
         var frame = (Frame) result;
         var lookup = new Lookup(task_master, source_ref, new []{"type"}, Context.Prepend(frame, null));
         lookup.Notify(type_result => {
             if (type_result is long) {
                 switch ((long) type_result) {
                     case 0:
                         HandleSubstition(frame);
                         return;
                     case 1:
                         HandleRange(frame);
                         return;
                 }
             }
             task_master.ReportOtherError(source_ref, "Illegal transformation specified.");
         });
     } else {
         task_master.ReportOtherError(source_ref, "Non-frame in transformation list.");
     }
 }
开发者ID:davidhankins,项目名称:flabbergast,代码行数:22,代码来源:misc.cs


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