Example #1
0
        private void Active_Click(object Sender, RoutedEventArgs E)
        {
            if (!CurrentRoom.HasJoined(App.CurrentUser.Id) || App.CurrentUser.Id != CurrentRoom.Host.Id)
            {
                MessageBox.Show("您当前没有加入任何一个角色槽,也不是该房间的房主,故无法发出准备就绪之命令。",
                                "准备就绪?", MessageBoxButton.OK, MessageBoxImage.Information);
                return;
            }

            ActiveButton.Content   = "等待中...";
            ActiveButton.IsEnabled = false;
            ActiveButton.ToolTip   = "正等待所有加入角色槽的玩家准备就绪。";

            foreach (var TempGroupItem in GroupStack.Children.OfType <Components.GroupItem>())
            {
                foreach (var ParticipantItem in TempGroupItem.ParticipantStack.Children.OfType <ParticipantItem>())
                {
                    if (ParticipantItem.Participant != null && ParticipantItem.Participant.Id == App.CurrentUser.Id)
                    {
                        ParticipantItem.Ready();
                    }
                }
            }
            DispatcherTimer Timer = new DispatcherTimer()
            {
                Interval = TimeSpan.FromSeconds(0.35)
            };

            Timer.Tick += delegate
            {
                ActiveButton.Foreground = new SolidColorBrush(Color.FromRgb(173, 173, 173));
                Timer.Stop();
            };
            Timer.Start();
        }
Example #2
0
        public void UpdateCell(string messageText, ParticipantItem participant, UIImage userImage)
        {
            _participant = participant ?? ParticipantItem.NullCustomer();

            _imageView.Image = userImage;
            UpdateParticipantInfo(participant.Name);
            _subheadingLabel.Text = messageText;
        }
        public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            var cell = tableView.DequeueReusableCell(CellIdentifier) as ParticipantCellView ??
                       new ParticipantCellView(CellIdentifier);

            var participant = indexPath.Row < _parentController.ParticipantItems.Count ?
                              _parentController.ParticipantItems [indexPath.Row] : ParticipantItem.NullCustomer();

            cell.UpdateCell(participant.Name, Converters.FromBase64(participant.Image));

            return(cell);
        }
Example #4
0
        public override float GetHeightForRow(UITableView tableView, NSIndexPath indexPath)
        {
            var cell = new CommentCellView(CellIdentifier);

            var item = indexPath.Row < _parentController.CommentItems.Count ? _parentController.CommentItems [indexPath.Row] : CommentItem.NullComment();

            cell.UpdateCell(item.Text, ParticipantItem.NullCustomer(), null);

            cell.SetNeedsUpdateConstraints();
            cell.UpdateConstraintsIfNeeded();

            cell.Bounds = new RectangleF(0, 0, _parentController.View.Bounds.Width, _parentController.View.Bounds.Height);

            cell.SetNeedsLayout();
            cell.LayoutIfNeeded();

            return(cell.ExpectedRowHeight < 60 ? 60 : cell.ExpectedRowHeight);
        }
        public void QueryHisConvPartByID(string _convID,string initiator)
        {
            List<ParticipantItem> list = new List<ParticipantItem>();
               int iSizeSTConfPartData = Marshal.SizeOf(typeof(STConfPartData));
               int iSizeSTConfPartItem = Marshal.SizeOf(typeof(STConfPartItem));
               int uiBufSize = (iSizeSTConfPartData + iSizeSTConfPartItem * (count - 1));
               byte[] pCallHistory = new byte[uiBufSize];

               UCServiceRetvCode iRet = (UCServiceRetvCode)query.QueryHisConvPartByID(_convID, 0, count - 1, pCallHistory, uiBufSize);
               if (UCServiceRetvCode.UC_SDK_Success == iRet)
               {
               IntPtr tempInfoIntPtr = Marshal.AllocHGlobal((int)iSizeSTConfPartData);
               byte[] tempInfoByte = new byte[iSizeSTConfPartData];

               Marshal.Copy(pCallHistory, 0, tempInfoIntPtr, (int)iSizeSTConfPartData);
               STConfPartData head = (STConfPartData)Marshal.PtrToStructure(tempInfoIntPtr, typeof(STConfPartData));
               ParticipantItem it;
               if (head.partNum > count)
               {
                   uiBufSize = (iSizeSTConfPartData + iSizeSTConfPartItem * (head.partNum - 1));
                   pCallHistory = new byte[uiBufSize];
                   query.QueryHisConvPartByID(_convID, 0, head.partNum - 1, pCallHistory, uiBufSize);
               }
               it = new ParticipantItem();
               it.Initiator = initiator;
               it.IsMain = true;
               list.Add(it);
               for (int i = -1; i < head.partNum - 1; i++)
               {
                   Marshal.Copy(pCallHistory, iSizeSTConfPartData + iSizeSTConfPartItem * i, tempInfoIntPtr, (int)iSizeSTConfPartItem);
                   STConfPartItem item = (STConfPartItem)Marshal.PtrToStructure(tempInfoIntPtr, typeof(STConfPartItem));
                   //2015/8/24    UTF8 转码UNICODE
                   //byte[] buffer1 = Encoding.Default.GetBytes(item.partName);
                   //byte[] buffer2 = Encoding.Convert(Encoding.UTF8, Encoding.Default, buffer1, 0, buffer1.Length);
                   //string item1 = Encoding.Default.GetString(buffer2, 0, buffer2.Length);
                   //2015/8/24    UTF8 转码UNICODE
                   it = new ParticipantItem();
                   //it.Initiator = item1;
                   it.Initiator = item.partName;
                   it.IsMain = false;
                   list.Add(it);
               }
               Marshal.Release(tempInfoIntPtr);
               }
               winHisitory.listParticipants.ItemsSource = null;
               winHisitory.listParticipants.ItemsSource = list;
        }
Example #6
0
        private void QuitRoom_Click(object Sender, RoutedEventArgs E)
        {
            if (App.CurrentUser.Id == CurrentRoom.Host.Id)
            {
                if (MessageBox.Show("作为一名房主,如果您退出房间,则意味着房间将被解散。" +
                                    "其他加入该房间的角色用户将被强制踢出。您确定要解散房间吗?", "退出房间",
                                    MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No)
                {
                    return;
                }
                foreach (var TempGroupItem in GroupStack.Children.OfType <Components.GroupItem>())
                {
                    foreach (var ParticipantItem in TempGroupItem.ParticipantStack.Children.OfType <ParticipantItem>())
                    {
                        ParticipantItem.Join(null);
                    }
                }
                CurrentRoom.Groups.ForEach(O =>
                {
                    for (int i = 0; i < O.Capacity; i++)
                    {
                        O.Participants[i] = null;
                    }
                });

                LeaveAction = delegate
                {
                    App.CurrentRoom = null;
                    App.Server.Stop();
                    App.Server = null;
                    MainWindow.Instance.EnterUserPage(false);
                };
                ChatWindow.AllowToClose = true;
                ChatWindow.Closing     -= HideSyncAction;
                ChatWindow.Close();
                this.PageLeave();
            }
            else
            {
                if (MessageBox.Show("您确定要放弃这场比赛并退出房间吗?", "退出房间",
                                    MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No)
                {
                    return;
                }
                foreach (var TempGroupItem in GroupStack.Children.OfType <Components.GroupItem>())
                {
                    foreach (var ParticipantItem in TempGroupItem.ParticipantStack.Children.OfType <ParticipantItem>())
                    {
                        if (ParticipantItem.Participant != null &&
                            ParticipantItem.Participant.Id == App.CurrentUser.Id)
                        {
                            ParticipantItem.Join(null);
                        }
                    }
                }
                CurrentRoom.RemoveUser(App.CurrentUser);
                App.CurrentRoom         = null;
                LeaveAction             = delegate { MainWindow.Instance.EnterUserPage(false); };
                ChatWindow.AllowToClose = true;
                ChatWindow.Closing     -= HideSyncAction;
                ChatWindow.Close();
                this.PageLeave();
            }
        }