public void AddNewMessage(InputField message) { MessageToSend messageToSend = new MessageToSend { ChannelId = _fixedChannel, Message = message.text, SocketId = _pusher.SocketID, UserId = _fixedUser }; TheDispatcher.RunOnMainThread(async() => { var result = await _api.SendMessage(messageToSend); if (result.IsSuccessStatusCode) { Debug.Log("Message sent to server successfully"); } else { Debug.Log($"Error: { result.StatusCode } - { await result.Content.ReadAsStringAsync() } "); } }); message.text = string.Empty; }
private void OnStateChanged_Player(object sender, AudioPlayer.StateChangedEventArgs e) { if (!TheDispatcher.CheckAccess()) { TheDispatcher.BeginInvoke(DispatcherPriority.Normal, (Action <object, AudioPlayer.StateChangedEventArgs>)OnStateChanged_Player_, sender, e); return; } OnStateChanged_Player_(sender, e); }
/* * public void AudioPlayer_ResetPlayStreamPosition() * { * m_PlayStream.Position = m_StreamRiffHeaderEndPos; * m_PlayStream.Seek(m_StreamRiffHeaderEndPos, SeekOrigin.Begin); * }*/ #region Event / Callbacks private void OnAudioPlaybackFinished(object sender, AudioPlayer.AudioPlaybackFinishEventArgs e) { if (!TheDispatcher.CheckAccess()) { TheDispatcher.BeginInvoke(DispatcherPriority.Normal, (Action <object, AudioPlayer.AudioPlaybackFinishEventArgs>)OnAudioPlaybackFinished_, sender, e); return; } #if DEBUG Debugger.Break(); #endif }
private void onPageFoundByFlowDocumentParser(TreeNode treeNode) { if (!TheDispatcher.CheckAccess()) { #if DEBUG Debugger.Break(); #endif TheDispatcher.Invoke(DispatcherPriority.Normal, (Action <TreeNode>)onPageFoundByFlowDocumentParser, treeNode); return; } PagesNavigator.AddPage(treeNode); RaisePropertyChanged(() => HasNotPages); }
private void onDescribableTreeNodeFoundByFlowDocumentParser(TreeNode data) { if (!TheDispatcher.CheckAccess()) { #if DEBUG Debugger.Break(); #endif TheDispatcher.Invoke(DispatcherPriority.Normal, (Action <TreeNode>)onDescribableTreeNodeFoundByFlowDocumentParser, data); return; } DescriptionsNavigator.AddDescribableTreeNode(data); RaisePropertyChanged(() => HasNotDescribableTreeNodes); }
public void OnUndoRedoManagerChanged(UndoRedoManagerEventArgs eventt, bool done, Command command, bool isTransactionEndEvent, bool isNoTransactionOrTrailingEdge) { if (!TheDispatcher.CheckAccess()) { #if DEBUG Debugger.Break(); #endif #if NET40x TheDispatcher.Invoke(DispatcherPriority.Normal, (Action <UndoRedoManagerEventArgs, bool, Command, bool, bool>)OnUndoRedoManagerChanged, eventt, done, command, isTransactionEndEvent, isNoTransactionOrTrailingEdge); #else TheDispatcher.Invoke(DispatcherPriority.Normal, (Action)(() => OnUndoRedoManagerChanged(eventt, done, command, isTransactionEndEvent, isNoTransactionOrTrailingEdge)) ); #endif return; } if (isTransactionEndEvent) { return; } if (command is CompositeCommand) { #if DEBUG Debugger.Break(); #endif } else if (command is TreeNodeSetIsMarkedCommand) { OnUndoRedoManagerChanged_TreeNodeSetIsMarkedCommand(eventt, done, (TreeNodeSetIsMarkedCommand)command, isTransactionEndEvent, isNoTransactionOrTrailingEdge); } else if (command is TreeNodeChangeTextCommand) { OnUndoRedoManagerChanged_TreeNodeChangeTextCommand(eventt, done, (TreeNodeChangeTextCommand)command, isTransactionEndEvent, isNoTransactionOrTrailingEdge); } else if (command is TextNodeStructureEditCommand) { OnUndoRedoManagerChanged_TextNodeStructureEditCommand(eventt, done, (TextNodeStructureEditCommand)command, isTransactionEndEvent, isNoTransactionOrTrailingEdge); } RaisePropertyChanged(() => SelectedTreeNode); }
public void OnUndoRedoManagerChanged(UndoRedoManagerEventArgs eventt, bool done, Command command, bool isTransactionEndEvent, bool isNoTransactionOrTrailingEdge) { if (!TheDispatcher.CheckAccess()) { #if DEBUG Debugger.Break(); #endif #if NET40x TheDispatcher.Invoke(DispatcherPriority.Normal, (Action <UndoRedoManagerEventArgs, bool, Command, bool, bool>)OnUndoRedoManagerChanged, eventt, done, command, isTransactionEndEvent, isNoTransactionOrTrailingEdge); #else TheDispatcher.Invoke(DispatcherPriority.Normal, (Action)(() => OnUndoRedoManagerChanged(eventt, done, command, isTransactionEndEvent, isNoTransactionOrTrailingEdge)) ); #endif return; } if (isTransactionEndEvent) { return; } if (command is CompositeCommand) { #if DEBUG Debugger.Break(); #endif } //if (!command.IsTransaction() // || done && command.IsTransactionLast() // || !done && command.IsTransactionFirst() // ) //{ //} }
private void PusherOnConnected(object sender) { Debug.Log("Connected"); _channel.Bind("new_message", (object data) => { try { var theData = data.ToString() .Replace("\\\"", "\"") .Replace("\"{", "{") .Replace("}\"", "}"); var received = JsonConvert.DeserializeObject <ChatMessage>(theData); if (received != null) { TheDispatcher.RunOnMainThread(() => AddMessage(received.Data.Message, received.Data.Name)); } } catch (Exception ex) { } }); }
public void OnUndoRedoManagerChanged(UndoRedoManagerEventArgs eventt, bool done, Command command, bool isTransactionEndEvent, bool isNoTransactionOrTrailingEdge) { if (!TheDispatcher.CheckAccess()) { #if DEBUG Debugger.Break(); #endif #if NET40x TheDispatcher.Invoke(DispatcherPriority.Normal, (Action <UndoRedoManagerEventArgs, bool, Command, bool, bool>)OnUndoRedoManagerChanged, eventt, done, command, isTransactionEndEvent, isNoTransactionOrTrailingEdge); #else TheDispatcher.Invoke(DispatcherPriority.Normal, (Action)(() => OnUndoRedoManagerChanged(eventt, done, command, isTransactionEndEvent, isNoTransactionOrTrailingEdge)) ); #endif return; } if (m_TTSGen) { return; } //if (isTransactionEndEvent) //{ // return; //} if (isNoTransactionOrTrailingEdge) { if (EventAggregator != null) { EventAggregator.GetEvent <StatusBarMessageUpdateEvent>().Publish(Tobi_Plugin_AudioPane_Lang.Ready); } } if (command is CompositeCommand) { #if DEBUG Debugger.Break(); #endif } else if (command is TreeNodeChangeTextCommand) { if (!isTransactionEndEvent) { var cmd = (TreeNodeChangeTextCommand)command; Tuple <TreeNode, TreeNode> selection = m_UrakawaSession.GetTreeNodeSelection(); if (selection.Item1 != null) { if (cmd.TreeNode == selection.Item1 || (cmd.TreeNode.IsDescendantOf(selection.Item1))) { if (State.Audio.HasContent && State.Audio.PlayStreamMarkers != null) { if (true //State.Audio.PlayStreamMarkers.Count <= Settings.Default.AudioWaveForm_TextCacheRenderThreshold ) { if (View != null) { View.InvalidateWaveFormOverlay(); } } else { CommandRefresh.Execute(); } } } } } return; } if (!(command is TextNodeStructureEditCommand) && !(command is AudioEditCommand)) { return; } if (!isTransactionEndEvent) { if (View != null) { View.CancelWaveFormLoad(false); } InterruptAudioPlayerRecorder(); if (View != null) { View.CancelWaveFormLoad(true); } CommandPause.Execute(); updateTotalDuration(command, done); } if (command is TextNodeStructureEditCommand) { if (isNoTransactionOrTrailingEdge) { // TODO: this is currently brute-force => refresh waveform correctly, depending on modified tree fragment (remove / insert) if (View != null) { View.ResetAll(); } if (AudioPlaybackStreamKeepAlive) { ensurePlaybackStreamIsDead(); } State.ResetAll(); m_LastSetPlayBytePosition = -1; m_StateToRestore = null; //if (View != null) //{ // View.InvalidateWaveFormOverlay(); //} //CommandRefresh.Execute(); var sel = m_UrakawaSession.GetTreeNodeSelection(); //m_UrakawaSession.PerformTreeNodeSelection(sel.Item1, sel.Item2) var selOld = new Tuple <TreeNode, TreeNode>(null, null); OnTreeNodeSelectionChanged(new Tuple <Tuple <TreeNode, TreeNode>, Tuple <TreeNode, TreeNode> >(selOld, sel)); } return; } else if (command is AudioEditCommand) { if (!isTransactionEndEvent || isNoTransactionOrTrailingEdge && command.IsInTransaction() && command.TopTransactionId() == AudioPaneViewModel.COMMAND_TRANSATION_ID__AUDIO_TTS) { OnUndoRedoManagerChanged_AudioEditCommand(eventt, done, (AudioEditCommand)command, isTransactionEndEvent, isNoTransactionOrTrailingEdge); } if (isNoTransactionOrTrailingEdge) { if (m_OnUndoRedoManagerChanged_targetNode1 != null && m_OnUndoRedoManagerChanged_byteStart >= 0 && (!m_OnUndoRedoManagerChanged_done || m_OnUndoRedoManagerChanged_byteDur > 0)) { bool deselectAndPosEnd = Settings.Default.Audio_DisableAfterRecordSelection && m_DeferredRecordingDataItems != null && // hack to detect actual recording operation, rather than REDO m_OnUndoRedoManagerChanged_done && m_OnUndoRedoManagerChanged_wasInitByAdd; UndoRedoManagerChanged_RestoreAudioTreeNodeSelectionState(m_OnUndoRedoManagerChanged_targetNode1, m_OnUndoRedoManagerChanged_targetNode2, m_OnUndoRedoManagerChanged_byteStart, m_OnUndoRedoManagerChanged_byteDur, m_OnUndoRedoManagerChanged_done, deselectAndPosEnd); if (command.IsInTransaction() && command.TopTransactionId() == AudioPaneViewModel.COMMAND_TRANSATION_ID__AUDIO_SPLIT_SHIFT) { CommandClearSelection.Execute(); } m_OnUndoRedoManagerChanged_targetNode1 = null; m_OnUndoRedoManagerChanged_targetNode2 = null; m_OnUndoRedoManagerChanged_byteStart = -1; m_OnUndoRedoManagerChanged_byteDur = 0; m_OnUndoRedoManagerChanged_done = false; m_OnUndoRedoManagerChanged_wasInitByRemove = false; m_OnUndoRedoManagerChanged_wasInitByAdd = false; } else { #if DEBUG Debugger.Break(); #endif } } return; } #if DEBUG Debugger.Break(); #endif if (View != null) { View.ResetAll(); } m_LastSetPlayBytePosition = 0; m_StateToRestore = null; if (AudioPlaybackStreamKeepAlive) { ensurePlaybackStreamIsDead(); } CommandRefresh.Execute(); }