List <double> IScopeElement.GetReading(TransientState solution) { return(new List <double> { solution.GetValue(in_pin.V), solution.GetValue(I) }); }
void photoChooseTask_Completed(object sender, PhotoResult e) { var capturedPicture = new CapturedPictureViewModel(e.OriginalFileName, e.ChosenPhoto); //set mode for camera TransientState.Set("CapturedPictureViewModel", capturedPicture); }
public override bool Execute(TransientState transientState) { bool prevState = recloser.State; bool newState = recloser.GetNewState(transientState, Time); recloser.State = newState; return(prevState != newState); }
private void cameraTask_Completed(object sender, PhotoResult e) { if (e.TaskResult == TaskResult.OK) { // Get the image temp file from e.OriginalFileName. // Get the image temp stream from e.ChosenPhoto. // Don't keep either the temp stream or file name. var capturedPicture = new CapturedPictureViewModel(e.OriginalFileName, e.ChosenPhoto); //set mode for camera TransientState.Set("CapturedPictureViewModel", capturedPicture); } }
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { var capturedPicture = TransientState.Get <CapturedPictureViewModel>("CapturedPictureViewModel"); if (capturedPicture != null) { TransientState.Set <CapturedPictureViewModel>(CapturePicturePage.ModelStateKey, capturedPicture); //NavigationService.Navigate<CapturePicturePage>(); this.NavigationService.Navigate(new Uri("/Views/Capture/CapturePicturePage.xaml", UriKind.Relative)); } base.OnNavigatedTo(e); }
public bool GetNewState(TransientState transientState, double time) { RecloserState recloserState = new RecloserState( transientState.GetValue(IA), transientState.GetValue(IB), transientState.GetValue(IC), transientState.GetValue(in_pin.VA), transientState.GetValue(in_pin.VB), transientState.GetValue(in_pin.VC), time, State); return(program.Execute(recloserState)); }
public async Task <string> PostEventIfUseful(string journalEntry, TransientState transientState = null) { // inject transient properties into event var eventBody = JsonSerializer.Deserialize <Dictionary <string, object> >(journalEntry); if (transientState != null) { eventBody.Add("_shipId", transientState._shipId); eventBody.Add("_systemName", transientState._systemName); eventBody.Add("_systemAddress", transientState._systemAddress); eventBody.Add("_systemCoordinates", transientState._systemCoordinates); } var entryWithTransientState = JsonSerializer.Serialize(eventBody); System.Diagnostics.Debug.WriteLine($"Event with transients: {entryWithTransientState}"); // compose body as formparts and post var content = new FormUrlEncodedContent(new Dictionary <string, string>() { ["commanderName"] = CmdrName, ["apiKey"] = ApiKey, ["fromSoftware"] = AppName, ["fromSoftwareVersion"] = AppVersion, ["message"] = entryWithTransientState }); HttpResponseMessage response = await client.PostAsync("api-journal-v1", content); if (response.IsSuccessStatusCode) { string r = await response.Content.ReadAsStringAsync(); System.Diagnostics.Debug.WriteLine($"Posted event to EDSM - StatusCode: {response.StatusCode}\nResponse: {r}"); return(r); } else { System.Diagnostics.Debug.Write($"Error posting event - StatusCode: {response.StatusCode}"); return(String.Empty); } }
public static void LoadTransientState(string player, TransientState transientState) { // TODO we need to make the server use POST instead of GET /*var json = JsonUtility.ToJson(playerState); * var data = System.Text.Encoding.UTF8.GetBytes(json);*/ var operation = new UnityWebRequest { url = GetReportURL(player), method = UnityWebRequest.kHttpVerbGET, // TODO //uploadHandler = new UploadHandlerRaw(data), downloadHandler = new DownloadHandlerBuffer() }.SendWebRequest(); operation.completed += delegate(AsyncOperation asyncOperation) { OnLoadCompleted(asyncOperation, transientState); }; }
public override bool Execute(TransientState x) { return(true); }