Ejemplo n.º 1
0
        private void ProcessCommands(RdlTagCollection tags)
        {
            List <RdlCommand> commands = tags.GetCommands();

            if (commands != null && commands.Count > 0)
            {
                foreach (var cmd in commands)
                {
                    if (cmd.TypeName.Equals("EXIT"))
                    {
#if DEBUG
                        StorageManager.WriteError(String.Format("[ {0} ]{1}{2}", DateTime.Now, Environment.NewLine, cmd.ToString()));
#endif
                        ScreenManager.SetScreen(new GameOfflineScreen());
                        //System.Windows.Browser.HtmlPage.Window.Eval("window.location.reload();");
                    }
                    if (cmd.TypeName.Equals("CHECKROLE"))
                    {
                        // Args:
                        // 0 = role
                        // 1 = is in role
                        Settings.Role = cmd.GetArg <string>(0);
                        bool isInRole = cmd.GetArg <bool>(1);
                        if (!String.IsNullOrEmpty(Settings.Role) && Settings.Role.ToLower().Equals("god") && isInRole)
                        {
                            btnAdmin.Visibility = Visibility.Visible;
                        }
                        else
                        {
                            btnAdmin.Visibility = Visibility.Collapsed;
                        }
                    }
                    if (cmd.TypeName.Equals("CONNECT"))
                    {
                        if (_hasErrors)
                        {
                            _waitDialog.HasCloseButton = true;
                        }
                        else
                        {
                            _waitDialog.Close();
                        }
                    }
                }
            }
        }