コード例 #1
0
        public static void Initialize()
        {
            Page = ExpansionKitApi.CreateCustomFullMenuPopup(LayoutDescription.WideSlimList);

            Page.AddLabel("Title", new Action <GameObject>((obj) => { titleObject = obj; }));
            Page.AddLabel("Waiting for key...", new Action <GameObject>((obj) => { textObject = obj; }));

            Page.AddSimpleButton("Clear", new Action(() =>
            {
                selectedKeys.Clear();
            }));

            Page.AddSimpleButton("Accept", new Action(() =>
            {
                AcceptAction?.Invoke(selectedKeys);
                fetchingKeys = false;
                Page.Hide();
            }));

            Page.AddSimpleButton("Cancel", new Action(() =>
            {
                CancelAction?.Invoke();
                fetchingKeys = false;
                Page.Hide();
            }));
        }
コード例 #2
0
 private void DoAccept(Token token, AcceptAction action)
 {
     continueParsing = false;
     accepted        = true;
     if (OnAccept != null)
     {
         OnAccept(this, new AcceptEventArgs((NonterminalToken)tokenStack.Peek()));
     }
 }
コード例 #3
0
        public bool Start(AcceptAction action)
        {
            if (m_started)
            {
                m_log.LogError(System.Reflection.MethodBase.GetCurrentMethod().Name,
                               "Attempted to start server a second time.");
                throw new ServerStartException("This server instance has already been started!");
            }

            if (action == null)
            {
                string err = "Attempted to start server with invalid AcceptAction";
                m_log.LogError(System.Reflection.MethodBase.GetCurrentMethod().Name, err);
                throw new ServerStartException(err);
            }

            try
            {
                m_acceptAction = action;
                //get server ready to listen for and accept connections
                m_sock.Bind(m_endPoint);
                m_sock.Listen(10);

                if (!m_database.LogoutAll())
                {
                    throw new Exception("Unable to log clients out of database!");
                }

                m_playerMaintainTimer = new Timer(new TimerCallback((object param) =>
                {
                    if (m_players.Count > 0)
                    {
                        RemoveDisconnectedPlayers();
                    }
                }), null, 0, 60000);
                m_bacteriaMaintainTimer = new Timer(World.AddBacteria, this, 0, 1000);
                m_playerSaveTimer       = new Timer(SavePlayerInfo, null, 0, 60000 * 5);

                //begin the accept loop
                m_sock.BeginAccept(_accept, null);
                m_started = true;
            }
            catch (Exception ex)
            {
                m_started = false;
                m_log.LogError(System.Reflection.MethodBase.GetCurrentMethod().Name,
                               "Unable to start the server: " + ex.Message);
                throw new ServerStartException("Unable to start the server!", ex);
            }

            return(m_started);
        }
コード例 #4
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     AcceptAction?.Invoke();
 }
コード例 #5
0
ファイル: DialogViewModel.cs プロジェクト: punker76/Maple
 /// <summary>
 /// Accepts this instance.
 /// </summary>
 public void Accept()
 {
     Close();
     AcceptAction?.Invoke();
 }