コード例 #1
0
        private void SendVideo()
        {
            if (ChatViewModel != null)
            {
                _targetModel.CanOperate = false;

                if (FileExists())
                {
                    AcioningItems.Add(this);
                    _operateTask = new System.Threading.CancellationTokenSource();
                    _targetModel.ResourceModel.FileState = FileStates.SendOffline;
                    if (AppData.CanInternetAction(""))
                    {
                        ChatViewModel.SendSmallVideoFile(_targetModel, _operateTask, async(result) =>
                        {
                            if (SDKClient.SDKClient.Instance.property.CurrentAccount.Isforbidden)
                            {
                                _targetModel.MessageState            = MessageStates.Warn;
                                _targetModel.ResourceModel.FileState = FileStates.Fail;
                            }

                            AcioningItems.Remove(this);
                            if (_operateTask != null)
                            {
                                _operateTask.Cancel();
                                _operateTask = null;
                            }
                        });
                    }
                    else
                    {
                        ChatViewModel.SaveSendingMessages(_targetModel);
                    }
                }
                else
                {
                    ChatViewModel.Chat.Messages.Remove(_targetModel);
                }
            }
        }