void BuildUI() { _pausedBackground = new Image(Content.Load <Texture2D>(Constants.Resources.TEXTURE_BACKGROUND_BLACK), Origin.TopLeft, 0, 0, 0, 0, 1, 0, 1, (float)0); _pausedBackground.Hidden = true; _root.Add(_pausedBackground); _pausedLabel = new Label(Content.Load <BitmapFont>(Constants.Resources.FONT_PONG_INTRO), Origin.Center, 0, 0, 0, 0, 0.25f, 0, AspectRatioType.HeightMaster); _pausedLabel.Content = Constants.Pong.PAUSED_CONTENT; _pausedLabel.Hidden = true; _root.Add(_pausedLabel); }
//---------------------------------------------------------------------------------------------------- static void SetupGQL() { // node interpreters for types Interpreters.Add(typeof(GameObject), new InterpreterGameObject()); Interpreters.Add(typeof(GameObject[]), new InterpreterGameObjectArray()); Interpreters.Add(typeof(Root), new InterpreterSearchRoot()); Func <object> scene = () => UnityEngine.SceneManagement.SceneManager.GetActiveScene().GetRootGameObjects(); Root.Add("scene", scene); Root.Add("stats", Stats.Singleton); Root.Add("events", Events.Singleton); }
void HandleNotificationMessage(NSDictionary notification) { var notificationSection = new Section(); var apsDictionary = notification["aps"] as NSDictionary; string body; if (apsDictionary["alert"] is NSDictionary alertDictionary) { notificationSection.Caption = alertDictionary["title"].ToString(); body = alertDictionary["body"].ToString(); } else { notificationSection.Caption = "«No Notification Title»"; body = apsDictionary["alert"].ToString(); } notificationSection.Add(new StringElement("Body", body)); AddCustomData(notification, notificationSection); Root.Add(notificationSection); }
// Actions to add: Post/Delete a Hello, see friend list, see Group and Publish a Photo void AddActionsSection() { strPostHello = new CustomStringElement("Post \"Hello\" on your wall", PostHello); var actionsSection = new Section("Actions") { strPostHello }; if (AccessToken.CurrentAccessToken.HasGranted("read_custom_friendlists")) { actionsSection.Add(new StringElement("See Friendlist", () => { NavigationController.PushViewController(new ListViewController(FacebookListType.Friends), true); })); } if (AccessToken.CurrentAccessToken.HasGranted("user_managed_groups")) { actionsSection.Add(new StringElement("See Managed Groups", () => { NavigationController.PushViewController(new ListViewController(FacebookListType.Groups), true); })); } actionsSection.Add(new StringElement("Publish photo", PostPhoto)); Root.Add(actionsSection); }
public void TestIf() { Kernel.DebugLevel = Flow.EDebugLevel.Verbose; var executed = false; var exp = New.If( () => true, New.Do(() => executed = true) );//.Named("IF1"); Root.Add(exp); Step(2); Assert.IsTrue(executed); executed = false; var exp2 = New.If( () => false, New.Do(() => executed = true) );//.Named("If2"); Root.Remove(exp); Root.Add(exp2); Step(2); Assert.IsFalse(executed); }
IEnumerator Main(GameBase game) { game.Print("Rendering..."); yield return(new WaitForSeconds(1)); yield return(DrawAll(game)); game.Print("Taking a screenshot"); yield return(null); using var img = game.TakeScreenshot(); tex = Texture2D.LoadFrom(img); g.Clear(); Root.Remove(g); game.Print("Generate a sprite from the screenshot"); yield return(new WaitForSeconds(1)); sprite = new Sprite(tex) { Scale = Vector.One * 0.25f, }; Root.Add(sprite); game.Print("Press ESC to return"); }
// // Queues a request to fetch the trends, and adds a new section to the root // void FetchTrends() { account.Download("http://search.twitter.com/trends/current.json", result => { try { if (result == null) { Root.Add(new Section(Locale.GetText("Trends")) { new StringElement(Locale.GetText("Error fetching trends")) }); return; } var json = JsonValue.Load(result); var jroot = (JsonObject)json ["trends"]; var jtrends = jroot.Values.FirstOrDefault(); trends = new Section(Locale.GetText("Trends")); for (int i = 0; i < jtrends.Count; i++) { trends.Add(new SearchElement(jtrends [i]["name"], jtrends [i]["query"])); } Root.Add(trends); } catch (Exception e) { Console.WriteLine(e); } }); }
public FeedbackComposerView() : base(true, UITableViewStyle.Plain) { _descriptionElement = new CustomInputElement(() => ViewModel.PostToImgurCommand, "Description"); this.WhenViewModel(x => x.Subject).Subscribe(x => _titleElement.Value = x); _titleElement.Changed += (sender, e) => ViewModel.Subject = _titleElement.Value; this.WhenViewModel(x => x.Description).Subscribe(x => _descriptionElement.Value = x); _descriptionElement.ValueChanged += (sender, e) => ViewModel.Description = _descriptionElement.Value; this.WhenViewModel(x => x.SubmitCommand).Subscribe(x => { NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Save, (s, e) => { ResignFirstResponder(); x.ExecuteIfCan(); }); x.CanExecuteObservable.Subscribe(y => NavigationItem.RightBarButtonItem.Enabled = y); }); Root.Add(new Section { _titleElement, _descriptionElement }); }
private void Render() { var model = ViewModel.Repository; var sec1 = new Section(); sec1.Add(_splitElements); var owner = new StyledStringElement("Owner", model.Owner.Login) { Image = Images.User, Accessory = UITableViewCellAccessory.DisclosureIndicator }; owner.Tapped += () => ViewModel.GoToOwnerCommand.ExecuteIfCan(); sec1.Add(owner); if (model.Parent != null) { var parent = new StyledStringElement("Forked From", model.Parent.FullName) { Image = Images.Fork, Accessory = UITableViewCellAccessory.DisclosureIndicator }; parent.Tapped += () => ViewModel.GoToForkParentCommand.Execute(model.Parent); sec1.Add(parent); } var events = new StyledStringElement("Events", () => ViewModel.GoToEventsCommand.ExecuteIfCan(), Images.Event); var sec2 = new Section { events }; if (model.HasIssues) { sec2.Add(new StyledStringElement("Issues", () => ViewModel.GoToIssuesCommand.ExecuteIfCan(), Images.Flag)); } if (ViewModel.Readme != null) { sec2.Add(new StyledStringElement("Readme", () => ViewModel.GoToReadmeCommand.ExecuteIfCan(), Images.File)); } var sec3 = new Section { new StyledStringElement("Commits", () => ViewModel.GoToCommitsCommand.ExecuteIfCan(), Images.Commit), new StyledStringElement("Pull Requests", () => ViewModel.GoToPullRequestsCommand.ExecuteIfCan(), Images.Hand), new StyledStringElement("Source", () => ViewModel.GoToSourceCommand.ExecuteIfCan(), Images.Script), }; Root.Reset(new Section(HeaderView) { _split }, sec1, sec2, sec3); if (!string.IsNullOrEmpty(model.Homepage)) { var web = new StyledStringElement("Website", () => ViewModel.GoToUrlCommand.Execute(model.Homepage), Images.Webpage); Root.Add(new Section { web }); } }
void LoadFiles() { DBError error; var contents = DBFilesystem.SharedFilesystem.ListFolder(path, out error); InvokeOnMainThread(() => { Root.Clear(); Root.Add(new Section()); }); foreach (DBFileInfo info in contents) { var localinfo = info; var filerow = new StyledStringElement(localinfo.Path.Name, () => { if (localinfo.IsFolder) { filesController = new DVCFiles(localinfo.Path); NavigationController.PushViewController(filesController, true); } else { DBError err; var file = DBFilesystem.SharedFilesystem.OpenFile(localinfo.Path, out err); var noteController = new NoteController(file); NavigationController.PushViewController(noteController, true); } }) { Accessory = localinfo.IsFolder ? UITableViewCellAccessory.DisclosureIndicator : UITableViewCellAccessory.None }; InvokeOnMainThread(() => Root[0].Add(filerow)); } }
IEnumerator Main() { var sprite = new Sprite("./ichigo.png"); Print("Generated sprite."); yield return(new WaitForSeconds(0.5f)); Root.Add(sprite); Print("Added it to the root container."); yield return(new WaitForSeconds(0.5f)); sprite.Location = (256, 256); Print("Moved it to (256, 256)."); yield return(new WaitForSeconds(2)); sprite.Scale = (2, 8); Print("Changed its scale, now the X is 2 times and the Y is 8 times."); yield return(new WaitForSeconds(2)); sprite.TintColor = Color.Blue; Print("Set the sprite's tint color to blue."); yield return(new WaitForSeconds(2)); sprite.Scale = (1, 1); sprite.TintColor = null; sprite.Size = (256, 192); Print("Set its width and height."); yield return(new WaitForSeconds(2)); Print("Press ESC to return"); }
public override void OnStart(Router router, GameBase game, System.Collections.Generic.Dictionary <string, object> args) { BackgroundColor = Color.FromArgb(255, 32, 32, 32); var titleText = new TextDrawable("DotFeather", 56, FontStyle.Normal, Color.White) { Location = new Vector(24, 24), }; Root.Add(titleText); var sampleProgramText = new TextDrawable($"Demo {DemoOS.VERSION}", 24, FontStyle.Normal, Color.White) { Location = new Vector(24 + titleText.Width + 8, 50), }; Root.Add(sampleProgramText); this.router = router; Root.Add(listView); listView.ItemSelected += ItemSelected; listView.Location = new Vector(16, titleText.Location.Y + titleText.Height + 16); ChangeDirectory(DemoOS.CurrentDirectory); }
public override async void ViewDidLoad() { var localData = DataManager.GetTopInfluencers(); var client = new WebDataHelper <IEnumerable <Influencer> >(); var list = await client.GetData("http://50.19.213.136:8080/skills-devdom/api/influencer/top/general.json"); var firstSection = new Section("Coolest Dev") { new BadgeElement(UIImage.FromBundle("me.jpg"), "Claudio Sanchez"), }; var section = new Section("Top 20"); Root.Add(firstSection); Root.Add(section); foreach (var influencer in list) { var image = await ImageHelper.LoadImage(influencer.picture); var element = new BadgeElement(image, string.Format("[{0}] {1}", influencer.position, influencer.fullName)); section.Add(element); } }
void AddToTableView() { if (adViewTableView == null) { // Setup your BannerView, review AdSizeCons class for more Ad sizes. adViewTableView = new BannerView(size: AdSizeCons.SmartBannerPortrait) { AdUnitID = AdMobConstants.BannerId, RootViewController = NavigationController }; // Wire AdReceived event to know when the Ad is ready to be displayed adViewTableView.AdReceived += (object sender, EventArgs e) => { if (!adOnTable) { Root.Add(new Section(caption: "Ad Section") { new UIViewElement(caption: "Ad", view: adViewTableView, transparent: true) }); adOnTable = true; } }; } adViewTableView.LoadRequest(GetRequest()); }
private void AddItemToRoot(ISolutionItem item) { var viewModel = new SolutionItemViewModel(itemNameRegistry, item); _itemToViewmodel.Add(item, viewModel); Root.Add(viewModel); }
public override void ViewDidLoad() { base.ViewDidLoad(); var username = ViewModel.Username; _header = new HeaderView(View.Bounds.Width) { Title = username }; Root.Add(new Section(_header)); var followers = new StyledStringElement("Followers".t(), () => NavigationController.PushViewController(new UserFollowersViewController(username), true), Images.Heart); var following = new StyledStringElement("Following".t(), () => NavigationController.PushViewController(new UserFollowingsViewController(username), true), Images.Following); var events = new StyledStringElement("Events".t(), () => NavigationController.PushViewController(new UserEventsViewController(username), true), Images.Event); var organizations = new StyledStringElement("Organizations".t(), () => NavigationController.PushViewController(new OrganizationsViewController(username), true), Images.Group); var repos = new StyledStringElement("Repositories".t(), () => NavigationController.PushViewController(new UserRepositoriesViewController(username), true), Images.Repo); var gists = new StyledStringElement("Gists", () => NavigationController.PushViewController(new AccountGistsViewController(username), true), Images.Script); Root.Add(new [] { new Section { events, organizations, followers, following }, new Section { repos, gists } }); }
public override void ViewDidLoad() { base.ViewDidLoad(); searchBar = new UISearchBar(new RectangleF(0, 0, 290, 44)) { ShowsScopeBar = true, }; searchBar.Placeholder = "Busqueda de promociones"; //View.Add(searchBar); Root.Add(new Section() { new StyledStringElement("Inicio", () => NavigationController.PushViewController(new RootViewController(), true)) { TextColor = UIColor.Black, BackgroundColor = UIColor.Clear }, new StyledStringElement("iBeacon", () => NavigationController.PushViewController(new CategoViewController(), true)) { TextColor = UIColor.Black, BackgroundColor = UIColor.Clear }, new StyledStringElement("Favoritos", () => NavigationController.PushViewController(new FavorViewController(), true)) { TextColor = UIColor.Black, BackgroundColor = UIColor.Clear }, new StyledStringElement("Ayuda", () => NavigationController.PushViewController(new AyudaViewController(), true)) { TextColor = UIColor.Black, BackgroundColor = UIColor.Clear }, }); TableView.SeparatorStyle = UITableViewCellSeparatorStyle.None; }
public override void OnStart(Router router, GameBase game, Dictionary <string, object> args) { ichigo = Texture2D.LoadFrom("ichigo.png"); Root.Add(container); var random = new System.Random(300); container.Add(new TextDrawable("O", 32, FontStyle.Normal, Color.White)); // container.Add(canvas); for (var i = 0; i < 8; i++) { container.Add(new Sprite(ichigo) { Location = random.NextVector(game.Width, game.Height), Scale = Vector.One + random.NextVectorFloat() * 7, Color = random.NextColor(), }); } game.Print("Scroll to move"); game.Print("Press ↑ to scale up"); game.Print("Press ↓ to scale down"); game.Print("Press ESC to return"); }
public void TestInsertExtract() { var chan = New.Channel <int>(); chan.Insert(1); chan.Insert(2); chan.Insert(3); var f0 = chan.Extract(); var f1 = chan.Extract(); var f2 = chan.Extract(); var f3 = chan.Extract(); Root.Add(chan); Step(5); Assert.IsTrue(f0.Available); Assert.IsTrue(f1.Available); Assert.IsTrue(f2.Available); Assert.IsFalse(f3.Available); Assert.AreEqual(1, f0.Value); Assert.AreEqual(2, f1.Value); Assert.AreEqual(3, f2.Value); }
public override void ViewDidLoad() { base.ViewDidLoad(); Root.Add(new Section() { new StyledStringElement("Home", () => NavigationController.PushViewController(new HomeViewController(), true)) { TextColor = UIColor.White, BackgroundColor = UIColor.Clear }, new StyledStringElement("About", () => NavigationController.PushViewController(new AboutViewController(), true)) { TextColor = UIColor.White, BackgroundColor = UIColor.Clear }, new StyledStringElement("Stuff", () => NavigationController.PushViewController(new StuffViewController(), true)) { TextColor = UIColor.White, BackgroundColor = UIColor.Clear }, }); TableView.SeparatorStyle = UITableViewCellSeparatorStyle.None; var img = new UIImageView(UIImage.FromFile("galaxy.png")); TableView.BackgroundView = img; }
// Load the cached searches, and then updates the contents if required void LoadSearches() { var cachedSearches = GetCachedResults(); savedSearches = new Section(Locale.GetText("Saved searches")); PopulateSearchFromArray(cachedSearches); Root.Add(savedSearches); if (SearchResultsAreRecent) { return; } account.Download("http://api.twitter.com/1/saved_searches.json", result => { if (result == null) { return; } LoadSearchResults(result); var freshResults = GetCachedResults(); if (freshResults.Length != cachedSearches.Length) { PopulateSearchFromArray(freshResults); } for (int i = 0; i < cachedSearches.Length; i++) { if (freshResults [i] != cachedSearches [i]) { PopulateSearchFromArray(freshResults); return; } } }); }
/// <summary> /// Add data to the tree. /// </summary> /// <param name="data"> Added data. </param> /// <exception cref="ArgumentNullException"><paramref name="data"/> is <c>null</c>.</exception> public void Add(T data) { // Check the input data for correctness. if (data == null) { throw new ArgumentNullException(nameof(data)); } // If there is no root element. if (Root == null) { // Write it down. Root = new Node <T>(data); Count = 1; return; } // If the elements match. Do not add. if (Root.Data.Equals(data)) { Console.WriteLine($"Element {Root.Data} already exist."); return; } // Add an item to the right or left. Root.Add(data); Count++; }
// Load the list of lists and setup their events private Task RefreshAsync() { AppDelegate.AddActivity(); return(this.db.Table <List>().ToListAsync().ContinueWith(t => { if (t.Exception != null) { BeginInvokeOnMainThread(ReloadComplete); AppDelegate.FinishActivity(); ShowError(t.Exception.Flatten().InnerException); return; } Section section = new Section(); section.AddAll(t.Result.Select(l => new StringElement(l.Name, () => { var tasks = new TasksViewController(this.db, l); NavigationController.PushViewController(tasks, true); }) ).Cast <Element>()); InvokeOnMainThread(() => { Root.Clear(); Root.Add(section); ReloadComplete(); AppDelegate.FinishActivity(); }); })); }
public void StartGroup(TestGroup testGroup) { BeginInvokeOnMainThread(() => { this.testsSection = new Section(testGroup.Name); Root.Add(this.testsSection); }); }
public DVCLogIn() : base(UITableViewStyle.Grouped, null, true) { loginView = new FBLoginView(ExtendedPermissions) { Frame = new RectangleF(74, 0, 151, 43) }; loginView.FetchedUserInfo += (sender, e) => { if (Root.Count < 3) { user = e.User; pictureView.ProfileID = user.Id; Root.Add(new Section("Hello " + user.Name) { new StringElement("Actions Menu", () => { var dvc = new DVCActions(user); NavigationController.PushViewController(dvc, true); }) { Alignment = UITextAlignment.Center } }); } }; loginView.ShowingLoggedOutUser += (sender, e) => { pictureView.ProfileID = null; if (Root.Count >= 3) { InvokeOnMainThread(() => { var section = Root[2]; section.Remove(0); Root.Remove(section); ReloadData(); }); } }; pictureView = new FBProfilePictureView() { Frame = new RectangleF(40, 0, 220, 220) }; Root = new RootElement("Facebook Sample") { new Section() { new UIViewElement("", loginView, true) { Flags = UIViewElement.CellFlags.DisableSelection | UIViewElement.CellFlags.Transparent, } }, new Section() { new UIViewElement("", pictureView, true) { Flags = UIViewElement.CellFlags.DisableSelection | UIViewElement.CellFlags.Transparent, }, } }; }
public override void ViewDidLoad() { base.ViewDidLoad(); _header = new HeaderView(View.Bounds.Width) { Title = Name }; Root.Add(new Section(_header)); var members = new StyledStringElement("Members".t(), () => NavigationController.PushViewController(new OrganizationMembersViewController(Name), true), Images.Following); var teams = new StyledStringElement("Teams".t(), () => NavigationController.PushViewController(new TeamsViewController(Name), true), Images.Team); var followers = new StyledStringElement("Followers".t(), () => NavigationController.PushViewController(new UserFollowersViewController(Name), true), Images.Heart); var events = new StyledStringElement("Events".t(), () => NavigationController.PushViewController(new UserEventsViewController(Name), true), Images.Event); var repos = new StyledStringElement("Repositories".t(), () => NavigationController.PushViewController(new OrganizationRepositoriesViewController(Name), true), Images.Repo); var gists = new StyledStringElement("Gists", () => NavigationController.PushViewController(new AccountGistsViewController(Name), true), Images.Script); Root.Add(new [] { new Section { members, teams }, new Section { events, followers }, new Section { repos, gists } }); }
public override void OnStart(Router router, GameBase game, Dictionary <string, object> args) { dotfeather = game; BackgroundColor = Color.FromArgb(27, 94, 32); audio.Play(Resources.I.BgmMain, 605106); snake.Add(GenPart(true)); trail.Insert(0, prevCursor); cursor = new VectorInt(game.Width / 4 - 8, game.Height / 2); prevCursor = cursor; trail.AddRange(Enumerable.Repeat(cursor, 256)); game.StartCoroutine(Intro(game)); UpdateTrail(); RenderSnake(); stageContainer.Scale *= 2; stageContainer.Add(snakeContainer); Root.Add(stageContainer); Root.Add(hud); }
public override void LoadView() { base.LoadView(); if (Aircraft == null) { Aircraft = new Aircraft(); exists = false; } Title = exists ? Aircraft.TailNumber : "New Aircraft"; profile = new EditAircraftProfileView(View.Bounds.Width); profile.Photograph = PhotoManager.Load(Aircraft.TailNumber, false); profile.TailNumber = Aircraft.TailNumber; profile.Model = Aircraft.Model; profile.Make = Aircraft.Make; Root.Add(CreateAircraftTypeSection()); Root.Add(new Section("Notes") { (notes = new LimitedEntryElement(null, "Enter any additional notes about the aircraft here.", Aircraft.Notes, 140)), }); Root[0].HeaderView = profile; cancel = new UIBarButtonItem(UIBarButtonSystemItem.Cancel, OnCancelClicked); NavigationItem.LeftBarButtonItem = cancel; save = new UIBarButtonItem(UIBarButtonSystemItem.Save, OnSaveClicked); NavigationItem.RightBarButtonItem = save; }
/// <summary> /// Overide of the Prepare creates the correct /// directories and files for the config /// </summary> protected override void Prepare() { DirectoryNode circleDir = Root.Add <DirectoryNode>(".circleci"); FileNode circleFile = circleDir.Add <FileNode>("config.yml"); circleFile.AddTemplate("circleci.yml"); Root.Add <DirectoryNode>(".github"); DirectoryNode devDir = Root.Add <DirectoryNode>("dev"); devDir.Add <DirectoryNode>("tests"); FileNode composeFile = devDir.Add <FileNode>("docker-compose.yaml"); composeFile.AddTemplate("application.yml"); DirectoryNode opsDir = Root.Add <DirectoryNode>("ops"); opsDir.Add <DirectoryNode>("deploy"); opsDir.Add <DirectoryNode>("provision"); opsDir.Add <DirectoryNode>("tests"); Root.Add <DirectoryNode>("tests"); }
public ResourceDirectoryNode <T> AddDirectoryNode(string name) { var node = new ResourceDirectoryNode <T>(name); Root.Add(node); return(node); }