public FavoritesView(UserData data, Func1 updateStatus, Func2 changeView, Func3 makeRequest) { //init user data userData = data; //init widgets items = new List <FavoriteItem>(); vBox = new VBox(false, 20); //populate item list foreach (UserData.Favorite f in userData.favorites) { items.Add(new FavoriteItem(f.url, f.name)); } //init and add items to the view for (int i = 0; i < items.Count; i++) { vBox.PackStart(items[i], false, false, 0); items[i].save.Clicked += (obj, args) => updateName((FavoriteItem)((Button)obj).Parent, updateStatus); items[i].gotoUrl.Clicked += (obj, args) => gotoFav(changeView, makeRequest, ((FavoriteItem)((Button)obj).Parent).urlEntry.Text); } //finalise this.Add(vBox); }
public HistoryView(UserData data, Func1 setButtons, Func2 changeView, Func3 makeRequest) { //init user data userData = data; //init widgets delete = new Button("Delete history"); vBox = new VBox(false, 20); //populate items list items = new List <HistoryItem>(); foreach (UserData.History h in userData.history) { items.Add(new HistoryItem(h.url, h.time.ToString(), h.title)); } //init and add items to the view for (int i = items.Count - 1; i >= 0; i--) { vBox.PackStart(items[i], false, false, 0); items[i].gotoUrl.Clicked += (obj, args) => gotoHistory(changeView, makeRequest, ((HistoryItem)((Button)obj).Parent.Parent).url); } //add main event handlers delete.Clicked += (obj, args) => deleteHistory(setButtons); //finish layout vBox.PackStart(delete, false, false, 0); this.Add(vBox); }
public object foldi(Object[] arr, object init, Func3 clos) { for (int i = 0; i < arr.Length; i++) { init = clos(i, init, arr[i]); } return(init); }
public Func3PipeFunction(Func3 fn) { this.fn = fn; }
/// <summary> /// Creates a pipe function that takes three arguments from pipe. /// </summary> /// <param name="fn">A delegate that encapsulates a method that match the signature of <see cref="Func3"/>.</param> /// <returns>The constructed pipe function that can be invoked with a given pipe context.</returns> public static PipeFunction Create(Func3 fn) { CommonHelper.ConfirmNotNull(fn, "fn"); return(new Func3PipeFunction(fn)); }
public void gotoFav(Func2 changeView, Func3 makeRequest, string url) { changeView(WebBrowser.States.Main); makeRequest(url, true); }
public object startProcess(string name, object[] args, string cwd, string stdin, Func3 onExit) { onExit(-1, "", ""); return(null); }
// The program part of the Main Menu // Directs players to other parts of the program public static void MenuProg() { string rawInput = "TBC"; char input = '0'; bool check = false; GameDraw(); // Checks if player input is valid while (!check) { Console.Write("\nYour Input: "); rawInput = Console.ReadLine(); try{ input = Convert.ToChar(rawInput); if (input >= 49 && input <= 56) { check = true; } else { GameDraw(); Console.WriteLine("\nError: '{0}' is not a valid input", rawInput); } } catch { if (rawInput == "") { check = true; } else { GameDraw(); Console.WriteLine("\nError: '{0}' is not a valid input", rawInput); } } } // Directs player to corresponding menu switch (input) { case '1': Func1.CovidAnnProg(Global.covidAnnPurch); break; case '2': Func2.HealthProg(); break; case '3': Func3.VaccineProg(); break; case '4': Func4.BorderProg(); break; case '5': Func5.DefenceProg(); break; case '6': Func6.EducationProg(); break; case '7': Intro(true); break; case '8': Help(); break; default: // Initiates all inputs and simulates Covid-19 Game.Submit(); break; } }
public void HandledBy(Func3 handler) { SetHandledBy(handler, 3, HandlerContextParam.None); }