Example #1
0
    /// <summary>
    /// allowNumで指定した回数に達するまでロックを掛けます。
    /// 非同期でアクションを実行します。実行後、ロックを解除します。
    /// </summary>
    /// <param name="key">Key.</param>
    /// <param name="action">Action.</param>
    /// <param name="allowNum">Allow number.</param>
    public static int Lock(string key, System.Action action, int allowNum = 1)
    {
        int restNum = SetLock(key, allowNum);

        if (restNum >= 0)
        {
            action.BeginInvoke((System.AsyncCallback)((System.IAsyncResult result) =>
            {
                ReleaseLock(key);
            }), null);
        }

        return(restNum);
    }
Example #2
0
 public override void Initialize()
 {
     nextScreen.StateManager = StateManager;
     nextScreen.Initialize();
     _loadMethod.BeginInvoke(new System.AsyncCallback(FinishedLoading), null);
 }