protected override void InvokeAction(Livet.Messaging.InteractionMessage m) { //// Convert to a message expected by this action //var confirmMessage = m as ConfirmationMessage; //if (confirmMessage != null) //{ // // Execute action using received the message // var result = MessageBox.Show( // confirmMessage.Text, // confirmMessage.Caption, // confirmMessage.Button, // confirmMessage.Image // ); // // If message has a return value, then set a response // if (result == MessageBoxResult.Yes || result == MessageBoxResult.OK) // { // confirmMessage.Response = true; // } // else // { // confirmMessage.Response = false; // } //} }
protected override void InvokeAction(Livet.Messaging.InteractionMessage m) { ////このアクションが対応するメッセージに変換します。 //var confirmMessage = m as ConfirmationMessage; //if (confirmMessage != null) //{ // //受け取ったメッセージの情報を使用して実行したいアクションを実行します。 // var result = MessageBox.Show( // confirmMessage.Text, // confirmMessage.Caption, // confirmMessage.Button, // confirmMessage.Image // ); // //戻り値のあるメッセージの場合、戻り値を設定します。 // if (result == MessageBoxResult.Yes || result == MessageBoxResult.OK) // { // confirmMessage.Response = true; // } // else // { // confirmMessage.Response = false; // } //} }
protected override void InvokeAction(Livet.Messaging.InteractionMessage m) { var txm = m as TransitionExMessage; if (txm == null) { return; } var targetWindow = txm.Target; var mode = txm.Mode; switch (txm.Mode) { case TransitionMode.Normal: case TransitionMode.Modal: targetWindow.Owner = Window.GetWindow(this.AssociatedObject); if (mode == TransitionMode.Normal) { targetWindow.Show(); } else { targetWindow.ShowDialog(); } break; } }
public async Task RaiseAsync(InteractionMessage message) { if (message == null) { throw new ArgumentNullException(nameof(message)); } if (!message.IsFrozen) { message.Freeze(); } await Task.Factory.StartNew(() => Raise(message)); }
internal void InvokeCallbacks(InteractionMessage message) { if (CallbackCommand != null) { if (CallbackCommand.CanExecute(message)) { CallbackCommand.Execute(message); } } if (CallbackMethodTarget != null && CallbackMethodName != null) { _callbackMethod.Invoke(CallbackMethodTarget, CallbackMethodName, message); } }
protected override void InvokeAction(Livet.Messaging.InteractionMessage m) { if (!(m is NavigationMessage navigationMessage)) { return; } if (NavigationHost is null) { throw new InvalidOperationException($"{nameof(NavigationHost)} is null."); } UserControl view = navigationMessage switch { { ViewName : "UserView" } => new UserView(),
protected override void InvokeAction(Livet.Messaging.InteractionMessage m) { if (m is ModalWindowActionMessage windowMessage && AssociatedObject != null) { var window = Window.GetWindow(AssociatedObject); if (window == null) { return; } window.DialogResult = windowMessage.DialogResult; } base.InvokeAction(m); }
public void Raise(InteractionMessage message) { if (message == null) { throw new ArgumentNullException(nameof(message)); } var threadSafeHandler = Interlocked.CompareExchange(ref Raised, null, null); if (threadSafeHandler != null) { if (!message.IsFrozen) { message.Freeze(); } threadSafeHandler(this, new InteractionMessageRaisedEventArgs(message)); } }
protected override void InvokeAction(Livet.Messaging.InteractionMessage m) { try { if (HostBorder != null) { HostBorder.Visibility = Visibility.Visible; } base.InvokeAction(m); } finally { if (HostBorder != null) { HostBorder.Visibility = Visibility.Collapsed; } } }
public void RaiseAsync(InteractionMessage message) { if (message == null) { throw new ArgumentException("messageはnullにできません"); } if (!message.IsFrozen) { message.Freeze(); } var task = Task.Factory.StartNew(() => Raise(message), CancellationToken.None, TaskCreationOptions.None, TaskScheduler.FromCurrentSynchronizationContext()); task.ContinueWith(t => { var e = new AsyncMessageFailedEventArgs(t.Exception); OnAsyncMessageFailed(e); t.Exception.Handle(ex => true); }, TaskContinuationOptions.OnlyOnFaulted | TaskContinuationOptions.ExecuteSynchronously); }
private void RaiseMessage(InteractionMessage message) { this.Messenger.Raise(message); }
public async void Confirm() { IsEnabledStep1 = IsEnabledStep2 = false; await AuthorizerViewModel.ConfirmPinCode(PinCode); if (AuthorizerViewModel.IsCompleted) { var msg = new InteractionMessage("CloseWindowKey"); Messenger.Raise(msg); } IsEnabledStep1 = IsEnabledStep2 = true; }
/// <summary> /// コンストラクタ /// </summary> /// <param name="message">InteractionMessage</param> public InteractionMessageRaisedEventArgs([NotNull] InteractionMessage message) { _message = message ?? throw new ArgumentNullException(nameof(message)); }
public InteractionMessageRaisedEventArgs(InteractionMessage message) { Message = message; }
public void Tweet() { if (!CanTweet()) return; if (!CanEdit) return; CanEdit = false; var status = Text; long? inReplyToStatusId = InReplyToStatus ? ((long?)_inReplyToStatusId) : null; var accounts = Settings.Current.Accounts.Where(a => a.IsActive); var count = accounts.Count(); int t = 0, f = 0; Action<bool> comp = b => { if (b) t++; else f++; if (t + f == count) { if (t == count) { var msg = new InteractionMessage("CloseWindowKey"); Messenger.Raise(msg); } CanEdit = true; } }; if (count == 0) return; foreach (var item in accounts) { if (Media.Count > 0) { item.UpdateWithMedia(status, Media.Select(x => x.GetBytes()), comp, InReplyToStatus ? ((long?)_inReplyToStatusId) : null); } else { item.Update(status, comp, InReplyToStatus ? ((long?)_inReplyToStatusId) : null); } } }