Пример #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();
        }