コード例 #1
0
 public InputDataViewModel(InputCoreViewModel parent,
                           InputData info, Action<InputData> removeHandler)
 {
     this.Parent = parent;
     this.Model = info;
     this._removeHandler = removeHandler;
 }
コード例 #2
0
 public PostSucceededEvent(InputData data)
 {
     this._body = data.Text;
 }
コード例 #3
0
ファイル: InputData.cs プロジェクト: kissge/StarryEyes
 public PostResult(InputData succeededs, InputData faileds, IEnumerable<Exception> throwns)
 {
     Succeededs = succeededs;
     Faileds = faileds;
     Exceptions = throwns;
 }
コード例 #4
0
 private void SendCore(InputData data)
 {
     data.Send()
         .Subscribe(r =>
         {
             if (r.Succeededs != null)
             {
                 InputModel.InputCore.LastPostedData = r.Succeededs;
                 BackstageModel.RegisterEvent(new PostSucceededEvent(r.Succeededs));
             }
             if (r.Faileds != null)
             {
                 var message = this.AnalyzeFailedReason(r.Exceptions) ??
                               InputAreaResources.MsgTweetFailedReasonUnknown;
                 var ed = r.Exceptions
                           .Guard()
                           .SelectMany(ex => EnumerableEx.Generate(
                               ex, e => e != null, e => e.InnerException, e => e))
                           .Where(e => e != null)
                           .Select(e => e.ToString())
                           .JoinString(Environment.NewLine);
                 if (Setting.ShowMessageOnTweetFailed.Value)
                 {
                     var resp = _parent.Messenger.GetResponse(new TaskDialogMessage(new TaskDialogOptions
                     {
                         Title = InputAreaResources.MsgTweetFailedTitle,
                         MainIcon = VistaTaskDialogIcon.Error,
                         MainInstruction = InputAreaResources.MsgTweetFailedInst,
                         Content = InputAreaResources.MsgTweetFailedContentFormat.SafeFormat(message),
                         ExpandedInfo = ed,
                         FooterText = InputAreaResources.MsgTweetFailedFooter,
                         FooterIcon = VistaTaskDialogIcon.Information,
                         VerificationText = Resources.MsgDoNotShowAgain,
                         CommonButtons = TaskDialogCommonButtons.RetryCancel
                     }));
                     Setting.ShowMessageOnTweetFailed.Value =
                         !resp.Response.VerificationChecked.GetValueOrDefault();
                     if (resp.Response.Result == TaskDialogSimpleResult.Retry)
                     {
                         this.SendCore(r.Faileds);
                         return;
                     }
                 }
                 else
                 {
                     BackstageModel.RegisterEvent(new PostFailedEvent(r.Faileds, message));
                 }
                 // Send to draft
                 InputModel.InputCore.Drafts.Add(r.Faileds);
             }
         });
 }
コード例 #5
0
 private void SendCore(InputData data)
 {
     data.Send()
         .Subscribe(r =>
         {
             if (r.Succeededs != null)
             {
                 InputModel.InputCore.LastPostedData = r.Succeededs;
                 BackstageModel.RegisterEvent(new PostSucceededEvent(r.Succeededs));
             }
             if (r.Faileds != null)
             {
                 var message = this.AnalyzeFailedReason(r.Exceptions) ?? "原因を特定できませんでした。";
                 if (Setting.ShowMessageOnTweetFailed.Value)
                 {
                     var resp = _parent.Messenger.GetResponse(new TaskDialogMessage(new TaskDialogOptions
                     {
                         Title = "ツイートの失敗",
                         MainIcon = VistaTaskDialogIcon.Error,
                         MainInstruction = "ツイートに失敗しました。",
                         Content = "エラー: " + message + Environment.NewLine +
                                   "もう一度投稿しますか?",
                         FooterText = "再試行しない場合は、ツイートしようとした内容は下書きとして保存されます。",
                         FooterIcon = VistaTaskDialogIcon.Information,
                         VerificationText = "次回から表示しない",
                         CommonButtons = TaskDialogCommonButtons.RetryCancel
                     }));
                     Setting.ShowMessageOnTweetFailed.Value =
                         !resp.Response.VerificationChecked.GetValueOrDefault();
                     if (resp.Response.Result == TaskDialogSimpleResult.Retry)
                     {
                         this.SendCore(r.Faileds);
                         return;
                     }
                 }
                 else
                 {
                     BackstageModel.RegisterEvent(new PostFailedEvent(r.Faileds, message));
                 }
                 // Send to draft
                 InputModel.InputCore.Drafts.Add(r.Faileds);
             }
         });
 }
コード例 #6
0
 public ImageDescriptionViewModel(InputData data, byte[] image)
 {
     _data = data;
     ByteArray = image;
 }
コード例 #7
0
 public PostFailedEvent(InputData data, string reason)
 {
     this._post = data.Text;
     this._reason = reason;
 }
コード例 #8
0
ファイル: InputCoreModel.cs プロジェクト: upsilon/StarryEyes
 internal InputCoreModel()
 {
     CurrentInputData = new InputData(String.Empty);
     _bindingHashtags.ListenCollectionChanged()
                     .Subscribe(_ =>
                     {
                         if (_currentFocusTabModel != null)
                         {
                             _currentFocusTabModel.BindingHashtags = _bindingHashtags.ToArray();
                         }
                     });
 }
コード例 #9
0
ファイル: InputCoreModel.cs プロジェクト: upsilon/StarryEyes
 public void ClearInput(string text, bool sendDraftIfChanged)
 {
     var current = _inputData;
     _inputData = new InputData(text);
     if (current.IsChanged && sendDraftIfChanged)
     {
         // if text is not changed, send to draft
         _drafts.Add(current);
     }
     _inputData.BoundTags = BindingHashtags.ToArray();
     RaisePropertyChanged(() => CurrentInputData);
 }
コード例 #10
0
ファイル: InputCoreModel.cs プロジェクト: upsilon/StarryEyes
 private void SetDirectMessage(IEnumerable<TwitterAccount> infos,
                               [NotNull] TwitterUser recipient,
                               bool focusToInputArea)
 {
     if (recipient == null) throw new ArgumentNullException("recipient");
     CurrentInputData = new InputData(String.Empty)
     {
         Accounts = infos,
         MessageRecipient = recipient
     };
     // because text is always empty, setting cursor position can be skipped.
     if (focusToInputArea)
     {
         FocusRequest.SafeInvoke();
     }
 }
コード例 #11
0
ファイル: InputCoreModel.cs プロジェクト: upsilon/StarryEyes
 private void SetText(IEnumerable<TwitterAccount> infos,
                      string body,
                      TwitterStatus inReplyTo,
                      CursorPosition cursor,
                      bool focusToInputArea)
 {
     CurrentInputData = new InputData(body)
     {
         Accounts = infos,
         InReplyTo = inReplyTo,
     };
     SetCursorRequest.SafeInvoke(cursor ?? CursorPosition.End);
     if (focusToInputArea)
     {
         FocusRequest.SafeInvoke();
     }
 }
コード例 #12
0
ファイル: InputData.cs プロジェクト: karno/StarryEyes
 private InputData Clone()
 {
     var newdata = new InputData(_initText)
     {
         _accounts = _accounts == null ? null : _accounts.ToArray(),
         _amendTweets = _amendTweets.ToDictionary(p => p.Key, p => p.Value),
         _boundTags = _boundTags,
         _geoInfo = _geoInfo,
         _inReplyTo = _inReplyTo,
         _initText = _initText,
         _messageRecipient = _messageRecipient,
         _text = _text
     };
     foreach (var image in _attachedImages)
     {
         newdata.AttachedImages.Add(image);
     }
     return newdata;
 }