public CouchApi( string urlHostPart, string urlDbPart, System.Net.WebHeaderCollection headers, bool isSelfChecking=true) { this.urlHostPart=urlHostPart; this.urlDbPart=urlDbPart; this.IsSelfChecking=IsSelfChecking; rest = new Rest("application/json", "application/json", headers); }
public BlowJobType() { Time= new Duration(); Sucks = new Duration(); Speed = new Duration(); Punish = new PunishMulti(); Rest= new Rest(); }
public DonPedroJob() { RalphURL = Properties.app.Default.ralph_url; ReportURL = RalphURL + Properties.app.Default.api_path; MaxTries = Properties.app.Default.max_tries; SecondsInterval = Properties.app.Default.tries_interval; ApiUser = Properties.app.Default.api_user; ApiKey = Properties.app.Default.api_key; ServicePointManager.ServerCertificateValidationCallback += delegate { return true; }; apiClient = new Rest(); }
/// <summary> /// Deserializes workflow markup into an rest object /// </summary> /// <param name = "xml">string workflow markup to deserialize</param> /// <param name = "obj">Output rest object</param> /// <param name = "exception">output Exception value if deserialize failed</param> /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns> public static bool Deserialize(string xml, out Rest obj, out Exception exception) { exception = null; obj = default(Rest); try { obj = Deserialize(xml); return true; } catch (Exception ex) { exception = ex; return false; } }
static void Main(string[] args) { var rest = new Rest(); var restCategotries = rest.getRestaurantCategories(); var restList = rest.GetResturants(5); var client = new MongoClient("mongodb://localhost:27017"); var server = client.GetServer(); var database = server.GetDatabase("Lucky"); var collection = database.GetCollection("restaurants"); collection.InsertBatch(restList); /*foreach (var document in collection.FindAll()) { Console.WriteLine(document["name"]); }*/ Console.Read(); }
internal static List<Rest> Insert(List<api.inner.Rest> value) { var ret = new List<Rest>(); try { value.ForEach(x => { var add = new Rest(); add.no = x.no; add.charid = x.charid; add.reststarttime = x.reststarttime; add.restendtime = x.restendtime; add.cardinfo = x.cardinfo; ret.Add(add); }); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } return ret; }
public override void UpdateActivity(IActivity act) { Rest.Put(Address + Url.Activities, act); }
public override void UpdateUser(IUser user) { Rest.Put(Address + Url.Users, user); }
public override void AddUser(IUser user) { Rest.Post(Address + Url.Users, user); }
public void ProcessToken(Rest rest) { CheckForBarline(rest.Length); }
public static bool LoadFromFile(string fileName, out Rest obj) { Exception exception = null; return LoadFromFile(fileName, out obj, out exception); }
/// <summary> /// Initializes a new instance of the <see cref="AccountStore"/> class. /// </summary> public AccountStore() { this.rest = new Rest(); }
public static async Task <TwilioMessage> GetMessage( RestCredentialInfo restCredentialInfo, string messageId) { var restCredential = new Rest( restCredentialInfo.AccountId, restCredentialInfo.SecretKey); var url = string.Format( SmsGetUrl, restCredentialInfo.AccountId, messageId); var response = await restCredential.GetAsync( url); var responseContent = await response.Content.ReadAsStringAsync(); var twilioMessage = new TwilioMessage(); var xmlDoc = new XmlDocument(); xmlDoc.LoadXml( responseContent); if (response.IsSuccessStatusCode) { try { twilioMessage.ReturnSid = xmlDoc.SelectSingleNode( "TwilioResponse/Message/Sid").InnerText; twilioMessage.Created = Convert.ToDateTime( xmlDoc.SelectSingleNode( "TwilioResponse/Message/DateCreated") .InnerText); twilioMessage.Updated = Convert.ToDateTime( xmlDoc.SelectSingleNode( "TwilioResponse/Message/DateUpdated") .InnerText); twilioMessage.Sent = Convert.ToDateTime( xmlDoc.SelectSingleNode( "TwilioResponse/Message/DateSent") .InnerText); twilioMessage.From = xmlDoc.SelectSingleNode( "TwilioResponse/Message/From").InnerText; twilioMessage.To = xmlDoc.SelectSingleNode( "TwilioResponse/Message/To").InnerText; twilioMessage.Message = xmlDoc.SelectSingleNode( "TwilioResponse/Message/Body").InnerText; twilioMessage.NumberOfSms = Convert.ToInt32(xmlDoc.SelectSingleNode( "TwilioResponse/Message/NumSegments").InnerText); twilioMessage.Status = xmlDoc.SelectSingleNode( "TwilioResponse/Message/Status").InnerText; twilioMessage.Direction = xmlDoc.SelectSingleNode( "TwilioResponse/Message/Direction").InnerText; var errorCode = xmlDoc.SelectSingleNode( "TwilioResponse/Message/ErrorCode"); if (errorCode != null) { var twilioException = new TwilioException() { Code = Convert.ToInt32(errorCode.InnerText), Message = xmlDoc.SelectSingleNode( "TwilioResponse/Message/ErrorMessage").InnerText }; twilioMessage.RestException = twilioException; } } catch { } } return(twilioMessage); }
private async void ToonGLAccounts() { string f = filter.Text.Trim(); list.ItemsSource = await Rest.getGLAccounts(f); }
public RestManager(Rest rest) { Rest = rest; }
private string ProcessRestElement(Rest aElement) { throw new NotImplementedException(); }
// TODO: split off R to get better type inference on T public static IWait <C> Call <C, T, R>(this IFiber <C> fiber, Rest <C, T> invokeHandler, T item, Rest <C, R> returnHandler) { // tell the leaf frame of the stack to wait for the return value var wait = fiber.Waits.Make <R>(); wait.Wait(returnHandler); fiber.Wait = wait; // call the child return(fiber.Call <C, T>(invokeHandler, item)); }
/* Constructor * */ public SPluginApi(Rest Rest, Database DB) { this.Rest = Rest; this.DB = DB; }
public override IActivity GetActivity(string id) { return(Json.ConvertFromTypedJson <IActivity>(Rest.Get(Address + Url.Activities, id))); }
protected static string GetErrorMessageWithRequestIdInfo(Rest.Azure.CloudException cloudException) { if (cloudException == null) { return "No information in the cloud exception."; } var sb = new StringBuilder(); if (!string.IsNullOrEmpty(cloudException.Message)) { sb.Append(cloudException.Message); } if (cloudException.Response == null) { return sb.ToString(); } if (cloudException.Response.Content != null) { var errorReturned = JsonConvert.DeserializeObject<PSComputeLongRunningOperation>( cloudException.Response.Content); if (errorReturned.Error != null) { sb.AppendLine().AppendFormat("ErrorCode: {0}", errorReturned.Error.Code); sb.AppendLine().AppendFormat("ErrorMessage: {0}", errorReturned.Error.Message); } if (errorReturned.StartTime != null) { sb.AppendLine().AppendFormat("StartTime: {0}", errorReturned.StartTime); } if (errorReturned.EndTime != null) { sb.AppendLine().AppendFormat("EndTime: {0}", errorReturned.EndTime); } if (string.IsNullOrWhiteSpace(errorReturned.OperationId) && !string.IsNullOrWhiteSpace(errorReturned.Name)) { sb.AppendLine().AppendFormat("OperationID: {0}", errorReturned.Name); } else if (!string.IsNullOrWhiteSpace(errorReturned.OperationId)) { sb.AppendLine().AppendFormat("OperationID: {0}", errorReturned.OperationId); } if (!string.IsNullOrWhiteSpace(errorReturned.Status)) { sb.AppendLine().AppendFormat("Status: {0}", errorReturned.Status); } } if (!cloudException.Response.StatusCode.Equals(HttpStatusCode.OK)) { sb.AppendLine().AppendFormat("StatusCode: {0}", cloudException.Response.StatusCode.GetHashCode()); sb.AppendLine().AppendFormat("ReasonPhrase: {0}", cloudException.Response.ReasonPhrase); if (cloudException.Response.Headers == null || !cloudException.Response.Headers.ContainsKey(RequestIdHeaderInResponse)) { return sb.ToString(); } string operationId = cloudException.RequestId; sb.AppendLine().AppendFormat( "OperationID : {0}", operationId); } return sb.ToString(); }
public static async Task <TwilioMessage> SendMessage( RestCredentialInfo restCredentialInfo, TwilioMessage twilioMessage) { var restCredential = new Rest( restCredentialInfo.AccountId, restCredentialInfo.SecretKey); var url = string.Format( SmsPostUrl, restCredentialInfo.AccountId); var content = new StringContent(twilioMessage.ToMessageString()); var response = await restCredential.PostAsync( url, content); var responseContent = await response.Content.ReadAsStringAsync(); var xmlDoc = new XmlDocument(); xmlDoc.LoadXml( responseContent); if (!response.IsSuccessStatusCode) { var restException = new TwilioException(); try { restException.Code = Convert.ToInt32( xmlDoc.SelectSingleNode( "TwilioResponse/RestException/Code") .InnerText); restException.Message = xmlDoc.SelectSingleNode( "TwilioResponse/RestException/Message").InnerText; restException.MoreInfo = xmlDoc.SelectSingleNode( "TwilioResponse/RestException/MoreInfo").InnerText; restException.Status = Convert.ToInt32( xmlDoc.SelectSingleNode( "TwilioResponse/RestException/Status") .InnerText); } catch (Exception ex) { restException = new TwilioException { Code = 0, Message = ex.Message, MoreInfo = "", Status = 0 }; } twilioMessage.Status = "failed"; twilioMessage.RestException = restException; } else { try { twilioMessage.ReturnSid = xmlDoc.SelectSingleNode( "TwilioResponse/Message/Sid").InnerText; twilioMessage.Created = Convert.ToDateTime( xmlDoc.SelectSingleNode( "TwilioResponse/Message/DateCreated") .InnerText); twilioMessage.Updated = Convert.ToDateTime( xmlDoc.SelectSingleNode( "TwilioResponse/Message/DateUpdated") .InnerText); var sentValue = xmlDoc.SelectSingleNode( "TwilioResponse/Message/DateSent"); if (sentValue.Value != null) { twilioMessage.Sent = Convert.ToDateTime(sentValue.InnerText); } twilioMessage.NumberOfSms = Convert.ToInt32( xmlDoc.SelectSingleNode( "TwilioResponse/Message/NumSegments") .InnerText); twilioMessage.Direction = xmlDoc.SelectSingleNode( "TwilioResponse/Message/Direction").InnerText; twilioMessage.Status = xmlDoc.SelectSingleNode( "TwilioResponse/Message/Status").InnerText; } catch (Exception ex) { } } return(twilioMessage); }
public NetworkStorage() { rest = new Rest(); }
public static async Task <TeamsInfo> GetTeams(this CompetitionInfo info) => await Rest.Get <TeamsInfo>(info.Links.Teams.Href);
// TODO: split off R to get better type inference on T public static IWait <C> Call <C, T, R>(this IFiber <C> fiber, Rest <C, T> invokeHandler, T item, Rest <C, R> returnHandler) { fiber.NextWait <R>().Wait(returnHandler); return(fiber.Call <C, T>(invokeHandler, item)); }
public static async Task <FixturesInfo> GetFixtures(this CompetitionInfo info) => await Rest.Get <FixturesInfo>(info.Links.Fixtures.Href);
protected override async Task <WebResponse> GetSession() { return(await Rest.StartEventsSession(new List <int> { _accountId })); }
public static async Task <LeagueTable> GetLeagueTable(this CompetitionInfo info) => await Rest.Get <LeagueTable>(info.Links.LeagueTable.Href);
public override void AddActivity(IActivity activity) { Rest.Post(Address + Url.Activities, activity); }
public static async Task <LeagueTable> GetLeagueTable(this CompetitionInfo info, int matchDay) => await Rest.Get <LeagueTable>($"{info.Links.LeagueTable.Href}?matchday={matchDay}");
public override void RemoveUser(string id) { Rest.Delete(Address + Url.Users, id); }
public static async Task <CompetitionInfo> GetCompetition(this LeagueTable info) => await Rest.Get <CompetitionInfo>(info.Links.Competition.Href);
public override IUser GetUser(string id) { return(Json.ConvertFromTypedJson <IUser>(Rest.Get(Address + Url.Users, id))); }
public RestManager(Rest rest, TPulse tPulse) { Rest = rest; TPulse = tPulse; }
public override void RemoveActivity(string id) { Rest.Delete(Address + Url.Activities, id); }
public void dec_excute() { var emp_id = (from d in db.SelfCards select new { d.PersonId, full = d.FirstName + " " + d.FatherName + " " + d.LastName,d.Salary,d.Workplace,d.JobTitle,d.Category,d.Register }).ToList(); var id = emp_id.Where(d => d.full == emp_name.Text).ToList().ElementAt(0); if (res_per1.IsChecked == true) { res_per = res_per1.Content.ToString(); } if (res_per2.IsChecked == true) { res_per = res_per2.Content.ToString(); } if (res_per3.IsChecked == true) { res_per = res_per3.Content.ToString(); } Rest r = new Rest { PersonId = id.PersonId, DecisionId = long.Parse(dec_id.Text), RestType = res_type.Text, RestStart = res_start.SelectedDate, RestEnd = res_end.SelectedDate, Period = res_per, RestPeriod = Int32.Parse(perod.Text), Attachment = att.Text, Notes = note.Text, Salary=id.Salary,Workplace=id.Workplace,JobTitle=id.JobTitle,Category=id.Category,Register= Login.regNames }; db.Rests.Add(r); db.SaveChanges(); MessageBox.Show("تم إضافة الاجازة بنجاح"); string message = "هل انتهى تنفيذ القرار؟"; string caption = "تنبيه"; var result = MessageBox.Show(message, caption, MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) { res_per1.IsChecked = false; res_per2.IsChecked = false; res_per3.IsChecked = false; res_start.Text = null; res_type.Text = null; res_end.Text = null; emp_name.Text = null; att.Text = ""; note.Text = ""; perod.Text = ""; this.Visibility = Visibility.Collapsed; var d = db.Decisions.Where(c => c.DecisionId == long.Parse(dec_id.Text)).Single(); excute.IsChecked = true; // d.IsExcute = true; d.IsExcute = true; db.Decisions.Update(d); db.SaveChanges(); Decision_View dv = new Decision_View(); Window parentWindow = Window.GetWindow(this); parentWindow.Close(); dv.Show(); } else if (result == MessageBoxResult.No) { res_per1.IsChecked = false; res_per2.IsChecked = false; res_per3.IsChecked = false; res_start.Text = null; res_type.Text = null; res_end.Text = null; emp_name.Text = null; att.Text = ""; note.Text = ""; perod.Text = ""; } }
public ComputeCloudException(Rest.Azure.CloudException ex) : base(GetErrorMessageWithRequestIdInfo(ex), ex) { }
/// <summary> /// Installs the target application on the target device. /// </summary> /// <param name="waitForDone">Should the thread wait until installation is complete?</param> /// <returns>True, if Installation was a success.</returns> public static async Task <bool> InstallAppAsync(string appFullPath, DeviceInfo targetDevice, bool waitForDone = true) { Debug.Assert(!string.IsNullOrEmpty(appFullPath)); var isAuth = await EnsureAuthenticationAsync(targetDevice); if (!isAuth) { return(false); } Debug.Log($"Starting install on {targetDevice.MachineName}..."); // Calculate the cert and dependency paths string fileName = Path.GetFileName(appFullPath); string certFullPath = Path.ChangeExtension(appFullPath, ".cer"); string certName = Path.GetFileName(certFullPath); string depPath = $@"{Path.GetDirectoryName(appFullPath)}\Dependencies\x86\"; var form = new WWWForm(); try { // APPX file Debug.Assert(appFullPath != null); using (var stream = new FileStream(appFullPath, FileMode.Open, FileAccess.Read, FileShare.Read)) { using (var reader = new BinaryReader(stream)) { form.AddBinaryData(fileName, reader.ReadBytes((int)reader.BaseStream.Length), fileName); } } // CERT file Debug.Assert(certFullPath != null); using (var stream = new FileStream(certFullPath, FileMode.Open, FileAccess.Read, FileShare.Read)) { using (var reader = new BinaryReader(stream)) { form.AddBinaryData(certName, reader.ReadBytes((int)reader.BaseStream.Length), certName); } } // Dependencies IOFileInfo[] depFiles = new DirectoryInfo(depPath).GetFiles(); foreach (IOFileInfo dep in depFiles) { using (var stream = new FileStream(dep.FullName, FileMode.Open, FileAccess.Read, FileShare.Read)) { using (var reader = new BinaryReader(stream)) { string depFilename = Path.GetFileName(dep.FullName); form.AddBinaryData(depFilename, reader.ReadBytes((int)reader.BaseStream.Length), depFilename); } } } } catch (Exception e) { Debug.LogException(e); return(false); } // Query string query = $"{string.Format(InstallQuery, FinalizeUrl(targetDevice.IP))}?package={UnityWebRequest.EscapeURL(fileName)}"; var response = await Rest.PostAsync(query, form, targetDevice.Authorization); if (!response.Successful) { if (response.ResponseCode == 403 && await RefreshCsrfTokenAsync(targetDevice)) { return(await InstallAppAsync(appFullPath, targetDevice, waitForDone)); } Debug.LogError($"Failed to install {fileName} on {targetDevice.MachineName}."); return(false); } var status = AppInstallStatus.Installing; // Wait for done (if requested) while (waitForDone && status == AppInstallStatus.Installing) { status = await GetInstallStatusAsync(targetDevice); switch (status) { case AppInstallStatus.InstallSuccess: Debug.Log($"Successfully installed {fileName} on {targetDevice.MachineName}."); return(true); case AppInstallStatus.InstallFail: Debug.LogError($"Failed to install {fileName} on {targetDevice.MachineName}."); return(false); } } return(true); }
//构造函数 public Entity() { eat=new Eat(); drink=new Drink(); rest=new Rest(); }
public VoidMethod(Rest <C, T> rest) { SetField.NotNull(out this.rest, nameof(rest), rest); }
public static bool Deserialize(string xml, out Rest obj) { Exception exception = null; return Deserialize(xml, out obj, out exception); }
public void Start() { this.draw = true; this.influenceMapDebugMode = 0; this.navMesh = NavigationManager.Instance.NavMeshGraphs[0]; this.Character = new DynamicCharacter(this.gameObject); //initialization of the movement algorithms this.aStarPathFinding = new NodeArrayAStarPathFinding(this.navMesh, new EuclideanDistanceHeuristic(), this); this.aStarPathFinding.NodesPerSearch = 500; var steeringPipeline = new SteeringPipeline { MaxAcceleration = 40.0f, MaxConstraintSteps = 2, Character = this.Character.KinematicData, }; this.decomposer = new PathFindingDecomposer(steeringPipeline, this.aStarPathFinding); this.Targeter = new FixedTargeter(steeringPipeline); steeringPipeline.Targeters.Add(this.Targeter); steeringPipeline.Decomposers.Add(this.decomposer); steeringPipeline.Actuator = new FollowPathActuator(steeringPipeline); this.Character.Movement = steeringPipeline; //initialization of the Influence Maps this.RedInfluenceMap = new InfluenceMap(this.navMesh,new SimpleUnorderedList(), new ClosedLocationRecordDictionary(), new LinearInfluenceFunction(), 0.1f); this.GreenInfluenceMap = new InfluenceMap(this.navMesh, new SimpleUnorderedList(), new ClosedLocationRecordDictionary(), new LinearInfluenceFunction(), 0.1f); this.ResourceInfluenceMap = new InfluenceMap(this.navMesh, new SimpleUnorderedList(), new ClosedLocationRecordDictionary(), new LinearInfluenceFunction(), 0.1f); this.CombinedInfluence = new Dictionary<LocationRecord, float>(); this.SecurityMap = new Dictionary<LocationRecord, float>(); //initialization of the GOB decision making //let's start by creating 5 main goals //the eat goal is the only goal that increases at a fixed rate per second, it increases at a rate of 0.1 per second this.SurviveGoal = new Goal(SURVIVE_GOAL, 2.0f); this.EatGoal = new Goal(EAT_GOAL, 1.0f) { ChangeRate = 0.1f }; this.GetRichGoal = new Goal(GET_RICH_GOAL, 1.0f) { InsistenceValue = 5.0f, ChangeRate = 0.2f }; this.RestGoal = new Goal(REST_GOAL, 1.0f); this.ConquerGoal = new Goal(CONQUER_GOAL, 1.5f) { InsistenceValue = 5.0f }; this.Goals = new List<Goal>(); this.Goals.Add(this.SurviveGoal); this.Goals.Add(this.EatGoal); this.Goals.Add(this.GetRichGoal); this.Goals.Add(this.RestGoal); this.Goals.Add(this.ConquerGoal); //initialize the available actions var restAction = new Rest(this); this.Actions = new List<Action>(); this.Actions.Add(restAction); this.Actions.Add(new PlaceFlag(this)); this.ActiveResources = new Dictionary<NavigationGraphNode, IInfluenceUnit>(); int boars = 0; int chests = 0; int trees = 0; int beds = 0; foreach (var chest in GameObject.FindGameObjectsWithTag("Chest")) { chests++; this.Actions.Add(new PickUpChest(this, chest)); this.AddResource(new Resource(this.navMesh.QuantizeToNode(chest.transform.position, 1.0f))); } foreach (var tree in GameObject.FindGameObjectsWithTag("Tree")) { trees++; this.Actions.Add(new GetArrows(this, tree)); this.AddResource(new Resource(this.navMesh.QuantizeToNode(tree.transform.position, 1.0f))); } foreach (var bed in GameObject.FindGameObjectsWithTag("Bed")) { beds++; this.Actions.Add(new Sleep(this, bed)); this.AddResource(new Resource(this.navMesh.QuantizeToNode(bed.transform.position, 1.0f))); } foreach (var boar in GameObject.FindGameObjectsWithTag("Boar")) { boars++; this.AddResource(new Resource(this.navMesh.QuantizeToNode(boar.transform.position, 1.0f))); this.Actions.Add(new MeleeAttack(this, boar)); this.Actions.Add(new Shoot(this, boar)); } this.ResourceInfluenceMap.Initialize(this.ActiveResources.Values.ToList()); //flags used for the influence map this.RedFlags = new List<IInfluenceUnit>(); foreach (var redFlag in GameObject.FindGameObjectsWithTag("RedFlag")) { this.RedFlags.Add(new Flag(this.navMesh.QuantizeToNode(redFlag.transform.position, 1.0f), FlagColor.Red)); } this.GreenFlags = new List<IInfluenceUnit>(); foreach (var greenFlag in GameObject.FindGameObjectsWithTag("GreenFlag")) { this.GreenFlags.Add(new Flag(this.navMesh.QuantizeToNode(greenFlag.transform.position, 1.0f), FlagColor.Green)); } this.RedInfluenceMap.Initialize(this.RedFlags); this.GreenInfluenceMap.Initialize(this.GreenFlags); var worldModel = new CurrentStateWorldModelFEAR(this.GameManager, this.Actions, this.Goals); worldModel.InitArrays( boars, trees, beds, chests); this.GOAPDecisionMaking = new DepthLimitedGOAPDecisionMaking(worldModel,this.Actions,this.Goals); }
/// <summary> /// Deserializes xml markup from file into an rest object /// </summary> /// <param name = "fileName">string xml file to load and deserialize</param> /// <param name = "obj">Output rest object</param> /// <param name = "exception">output Exception value if deserialize failed</param> /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns> public static bool LoadFromFile(string fileName, out Rest obj, out Exception exception) { exception = null; obj = default(Rest); try { obj = LoadFromFile(fileName); return true; } catch (Exception ex) { exception = ex; return false; } }
/// <summary> /// Initializes a new instance of the <see cref="StreamStore"/> class. /// </summary> public StreamStore() { this.rest = new Rest(); }
public static Rest <C, T> Loop <C, T>(Rest <C, T> rest, int count) { var loop = new LoopMethod <C, T>(rest, count); return(loop.LoopAsync); }
/// <summary> /// Submit a person group training task. Training is a crucial step that only a trained person group can be used by Face - Identify. /// </summary> /// <param name="personGroupId">Target person group to be trained.</param> /// <returns>A successful call returns an empty JSON body.</returns> public static async Task TrainGroupAsync(string personGroupId) { var query = string.Format(TrainQuery, FaceApiClient.ResourceRegion.ToString().ToLower(), personGroupId); await Rest.PostAsync(query, FaceApiClient.ApiKeyHeader); }
private void MapTo(Rest.User user) { user.Email = Email; user.FullName = FullName; }
public static Rest <C, T> Void <C, T>(Rest <C, T> rest) { var root = new VoidMethod <C, T>(rest); return(root.RootAsync); }
public LoopMethod(Rest <C, T> rest, int count) { SetField.NotNull(out this.rest, nameof(rest), rest); this.count = count; }
public void OpenSong() { List <SongComponent> selectedSongComponents = new List <SongComponent>(); using (DatabaseContext db = new DatabaseContext()) { //var ding = db.SongComponents; var comps = from sc in db.SongComponents.ToList() where sc.songID == SelectedSong.SongID orderby sc.AbsoluteX ascending select sc; selectedSongComponents = comps.ToList(); } SelectedSong.Measures.Clear(); //Song songToLoad = new Song(SelectedSong.BeatsPerMeasure, (int)SelectedSong.BeatLength); if (selectedSongComponents.Count > 0) { Measure measure = new Measure(); int getal = 0; foreach (SongComponent sc in selectedSongComponents) { getal += (int)sc.Length; if (getal > SelectedSong.MeasureLength) { SelectedSong.Measures.Add(measure); measure = new Measure(); getal = 0 + (int)sc.Length; } if (sc is Note) { Note s = (Note)sc; Note note = new Note((NoteLetter)sc.Y, sc.Octave, s.Black, sc.Length, sc.X); measure.Components.Add(note); } else { Rest rest = new Rest(sc.Length, sc.X); measure.Components.Add(rest); } } if (measure.Components.Count > 0) { SelectedSong.Measures.Add(measure); } parent.songPlayer.CurrentSong = SelectedSong; parent.songPlayer.Bpm = SelectedSong.BeatsPerMinute; // Enable afspeelknopjes parent.windowLeerling.buttonStart.Enabled = true; parent.windowLeerling.buttonStop.Enabled = true; parent.windowLeerling.buttonPause.Enabled = true; windowSelectSong.Close(); parent.windowLeerling.xToolStripMenuItem2.Checked = true; parent.windowLeerling.xToolStripMenuItem1.Checked = false; parent.windowLeerling.xToolStripMenuItem.Checked = false; parent.windowLeerling.xToolStripMenuItem3.Checked = false; parent.windowLeerling.toolStripMenuItem2.Checked = false; parent.windowLeerling.xToolStripMenuItem4.Checked = false; } else { MessageBox.Show("Liedje heeft geen noten!"); } }
/// <summary> /// Initializes a new instance of the <see cref="GifStore"/> class. /// </summary> public GifStore() { this.rest = new Rest("http://api.gifme.io"); }