public UpdateTVAPage(TVA tva) { InitializeComponent(); var viewModel = new UpdateTVAViewModel(); viewModel.TVA = tva; BindingContext = viewModel; }
public async void EditTVA() { Value = true; var connection = await apiService.CheckConnection(); if (!connection.IsSuccess) { await Application.Current.MainPage.DisplayAlert( Languages.Warning, Languages.CheckConnection, Languages.Ok); return; } if (string.IsNullOrEmpty(TVA.code) || string.IsNullOrEmpty(TVA.value)) { Value = true; return; } var tva = new TVA { id = TVA.id, code = TVA.code, description = TVA.description, value = TVA.value, bolla = TVA.bolla, isDefault = TVA.isDefault }; var cookie = Settings.Cookie; //.Split(11, 33) var res = cookie.Substring(11, 32); var response = await apiService.Put <TVA>( "https://portalesp.smart-path.it", "/Portalesp", "/tvaCode/update", res, tva); Debug.WriteLine("********responseIn ViewModel*************"); Debug.WriteLine(response); if (!response.IsSuccess) { await Application.Current.MainPage.DisplayAlert("Error", response.Message, "ok"); return; } Value = false; TVAViewModel.GetInstance().Update(tva); DependencyService.Get <INotification>().CreateNotification("PortalSP", "TVA Updated"); await App.Current.MainPage.Navigation.PopPopupAsync(true); }
/// <summary> /// Ajoute les données de l'entités dans un dictionnaire pour assurer la correspondance entre attributs et colonnes /// </summary> /// <returns> Le dictionnaire </returns> public Dictionary <string, string> Fetch() { Dictionary <string, string> res = new Dictionary <string, string> { { "nom", Name }, { "designation", Designation }, { "prix_achat", PurchasePrice.ToString(CultureInfo.CurrentCulture) }, { "prix_vente", SellPrice.ToString(CultureInfo.CurrentCulture) }, { "tva", TVA.ToString(CultureInfo.CurrentCulture) }, { "code_ean", EANCode } }; return(res); }
/// <summary> /// Creates a new IEEE C37.118 specific <see cref="IConfigurationFrame"/> based on provided protocol independent <paramref name="baseConfigurationFrame"/>. /// </summary> /// <param name="baseConfigurationFrame">Protocol independent <paramref name="IConfigurationFrame"/>.</param> /// <returns>A new IEEE C37.118 specific <see cref="IConfigurationFrame"/>.</returns> protected override IConfigurationFrame CreateNewConfigurationFrame(TVA.PhasorProtocols.Anonymous.ConfigurationFrame baseConfigurationFrame) { ConfigurationCell newCell; // Create a new IEEE C37.118 configuration frame 2 using base configuration ConfigurationFrame2 configurationFrame = new ConfigurationFrame2(m_timeBase, baseConfigurationFrame.IDCode, DateTime.UtcNow.Ticks, baseConfigurationFrame.FrameRate); foreach (TVA.PhasorProtocols.Anonymous.ConfigurationCell baseCell in baseConfigurationFrame.Cells) { // Create a new IEEE C37.118 configuration cell (i.e., a PMU configuration) newCell = new ConfigurationCell(configurationFrame, baseCell.IDCode, base.NominalFrequency); // Update other cell level attributes newCell.StationName = baseCell.StationName; newCell.IDLabel = baseCell.IDLabel; newCell.PhasorDataFormat = baseCell.PhasorDataFormat; newCell.PhasorCoordinateFormat = baseCell.PhasorCoordinateFormat; newCell.FrequencyDataFormat = baseCell.FrequencyDataFormat; newCell.AnalogDataFormat = baseCell.AnalogDataFormat; newCell.Tag = baseCell.IsVirtual; // Add phasor definitions foreach (IPhasorDefinition phasorDefinition in baseCell.PhasorDefinitions) { newCell.PhasorDefinitions.Add(new PhasorDefinition(newCell, phasorDefinition.Label, phasorDefinition.ScalingValue, phasorDefinition.Offset, phasorDefinition.PhasorType, null)); } // Add frequency definition newCell.FrequencyDefinition = new FrequencyDefinition(newCell, baseCell.FrequencyDefinition.Label); // Add analog definitions foreach (IAnalogDefinition analogDefinition in baseCell.AnalogDefinitions) { newCell.AnalogDefinitions.Add(new AnalogDefinition(newCell, analogDefinition.Label, analogDefinition.ScalingValue, analogDefinition.Offset, analogDefinition.AnalogType)); } // Add digital definitions foreach (IDigitalDefinition digitalDefinition in baseCell.DigitalDefinitions) { newCell.DigitalDefinitions.Add(new DigitalDefinition(newCell, digitalDefinition.Label)); } // Add new PMU configuration (cell) to protocol specific configuration frame configurationFrame.Cells.Add(newCell); } bool configurationChanged = false; // After system has started any subsequent changes in configuration get indicated in the outgoing data stream if (m_configurationFrame != null) configurationChanged = true; // Cache new IEEE C7.118 for later use Interlocked.Exchange(ref m_configurationFrame, configurationFrame); if (configurationChanged) { // Start adding configuration changed notification flag to data cells m_configurationChanged = true; m_notificationStartTime = DateTime.UtcNow.Ticks; } return configurationFrame; }
static void subscriber_StatusMessage(object sender, TVA.EventArgs<string> e) { lock (displayLock) { Console.WriteLine(e.Argument); } }
static void subscriber_ProcessException(object sender, TVA.EventArgs<Exception> e) { lock (displayLock) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("EXCEPTION: " + e.Argument.Message); Console.ResetColor(); } }
void dataSubscriber_StatusMessage(object sender, TVA.EventArgs<string> e) { //System.Diagnostics.Debug.WriteLine("SUBSCRIPTION: " + e.Argument); }
void Helper_ReceivedServiceUpdate(object sender, TVA.EventArgs<UpdateType, string> e) { DisplayMessage(e.Argument1, e.Argument2); }
// Exceptions from out-of-range measurements get forwarded to the ServiceProcessException event. private void serializableMeasurement_ProcessException(object sender, TVA.EventArgs<Exception> e) { OnServiceProcessException(e.Argument); }
void Helper_ReceivedServiceResponse(object sender, TVA.EventArgs<ServiceResponse> e) { string response = e.Argument.Type; string message = e.Argument.Message; string responseToClient = string.Empty; UpdateType responseType = UpdateType.Information; if (!string.IsNullOrEmpty(response)) { // Reponse types are formatted as "Command:Success" or "Command:Failure" string[] parts = response.Split(':'); string action; bool success; if (parts.Length > 1) { action = parts[0].Trim().ToTitleCase(); success = (string.Compare(parts[1].Trim(), "Success", true) == 0); } else { action = response; success = true; } if (success) { if (string.IsNullOrEmpty(message)) responseToClient = string.Format("{0} command processed successfully.\r\n\r\n", action); else responseToClient = string.Format("{0}\r\n\r\n", message); } else { responseType = UpdateType.Alarm; if (string.IsNullOrEmpty(message)) responseToClient = string.Format("{0} failure.\r\n\r\n", action); else responseToClient = string.Format("{0} failure: {1}\r\n\r\n", action, message); } DisplayMessage(responseType, responseToClient); } }
// Handles the audio graph's StatsUpdated event. Updates the properties // in this view-model so that they can be displayed to the user. private void AudioGraph_StatsUpdated(object sender, TVA.EventArgs<int, int, float, double> e) { double lostSamples = e.Argument4; this.SamplesPerSecond = e.Argument1; this.KilobitsPerSecond = e.Argument2; this.Smoothness = string.Format("{0:0.0000}", e.Argument3); if (double.IsNaN(lostSamples)) this.FractionSamplesLost = ". . ."; else if (lostSamples <= 0.0) this.FractionSamplesLost = "0.0000"; else this.FractionSamplesLost = string.Format("{0:0.0000}", lostSamples); }
// Handles the audio graph's PlaybackStateChanged event. Updates the // user interface to reflect what's going on in the playback. private void AudioGraph_PlaybackStateChanged(object sender, TVA.EventArgs<PlaybackState, string> e) { if (Dispatcher.Thread != Thread.CurrentThread) { Dispatcher.Invoke(new Action<object, TVA.EventArgs<PlaybackState, string>>(AudioGraph_PlaybackStateChanged), sender, e); } else { string defaultMessage = null; // Restore the various UI elements in case they // changed the last time the state was updated. Cursor = Cursors.Arrow; this.ControlPanel.IsEnabled = true; this.PlaybackStateLabel.Foreground = Brushes.White; this.PlaybackStateLabel.Content = ""; switch (e.Argument1) { case PlaybackState.Connected: case PlaybackState.Playing: this.ControlPanel.DisabledButtons.Visibility = System.Windows.Visibility.Collapsed; break; case PlaybackState.Connecting: case PlaybackState.Buffering: Cursor = Cursors.Wait; this.ControlPanel.IsEnabled = false; this.ControlPanel.DisabledButtons.Visibility = System.Windows.Visibility.Visible; defaultMessage = e.Argument1 + "..."; break; case PlaybackState.Disconnected: this.ControlPanel.DisabledButtons.Visibility = System.Windows.Visibility.Visible; break; case PlaybackState.TimedOut: this.PlaybackStateLabel.Foreground = Brushes.Red; defaultMessage = "Connection timed out"; break; case PlaybackState.Exception: this.PlaybackStateLabel.Foreground = Brushes.Red; defaultMessage = "Exception encountered"; break; } if (e.Argument2 != null) this.PlaybackStateLabel.Content = e.Argument2; else if (defaultMessage != null) this.PlaybackStateLabel.Content = defaultMessage; } }
private void UdpClient_ReceiveDataComplete(object sender, TVA.EventArgs<byte[], int> e) { try { // Multicast received data to all clients. m_udpServer.MulticastAsync(e.Argument1, 0, e.Argument2); } catch (Exception ex) { m_serviceHelper.ErrorLogger.Log(ex); m_serviceHelper.UpdateStatus(UpdateType.Warning, "Data Stream interrupted.\r\n\r\n"); } }
void audioGraph_GotSongList(object sender, TVA.EventArgs<List<string>> e) { SongList = e.Argument; }
void dataSubscriber_ProcessException(object sender, TVA.EventArgs<Exception> e) { //System.Diagnostics.Debug.WriteLine("SUBSCRIPTION: EXCEPTION: " + e.Argument.Message); }
void audioGraph_PlaybackStateChanged(object sender, TVA.EventArgs<PlaybackState, string> e) { isPlaying = (e.Argument1 == PlaybackState.Playing); switch (e.Argument1) { case PlaybackState.Disconnected: case PlaybackState.TimedOut: case PlaybackState.Stopped: case PlaybackState.Disposed: WavSubscriptionDemo.App.Current.Dispatcher.Invoke(new Action(waveFormRenderer.Reset)); break; } }
private void m_archiveReader_DataReadException(object sender, TVA.EventArgs<Exception> e) { ShowUpdateMessage("Exception encountered during data read: " + e.Argument.Message); }