static void Main(string[] args) { m_list = new List <Anything>(COUNT); var obj = new AnyTask(); obj.OnUpdate += new MainDelegate(ThreadMessages); obj.Test_Function(COUNT); Console.WriteLine(); foreach (var item in m_list) { Console.WriteLine("[Complete]:" + item.Text); } Console.WriteLine("Press any key to exit."); Console.ReadKey(); }
public StatePanel(Func <StatePanel, Task <object> > onRefreshAsync) { _taskFactory = AnyTask.Factory <object>(() => onRefreshAsync(this)); Update(); }
public MenuButton( object label, Action <Div> onClick = null, string svgIcon = null, string tooltip = null, object pill = null, AnyTask pillTask = null, Theme?pillTheme = Theme.Empty, IconButton[] actions = null) { this.SetClass("menu-button"); var button = new InternalButton(onClick, label, svgIcon, tooltip); this.VisualTree.Add(button); Control pillContainer = null; if (pillTask != null || pill != null) { var _pillContainer = new DumpContainer(); pillContainer = _pillContainer.ToControl(); this.VisualTree.Add(pillContainer); var formatter = new DefaultContentFormatter(); Control Format(object content) { return(formatter.Format(content, (c, e) => { if (e) { return c; } var span = new Span(c); span.AddClass("menu-button--pill"); if (pillTheme != null) { span.AddClass($"theme-{Utils.SplitCamelCase(pillTheme.ToString()).Replace(" ", "-").ToLower()}"); } return span; })); } if (pillTask != null) { pillTask.OnResult(result => { _pillContainer.Content = Format(result); }); } else { _pillContainer.Content = Format(pill); } } Div divActions = null; if (actions != null) { divActions = new Div( actions.Cast <Control>() ); divActions.SetClass("menu-button--actions"); this.VisualTree.Add(divActions); } if (actions != null) { JavascriptHelpers.ShowOnMouseOver(this, divActions, pillContainer); } }