예제 #1
0
        private void RPCClient_ReadyForSendingCommands(object sender, EventArgs e)
        {
            Log("Ready for sending commands...");

            Log("Trying to authenticate as SuperAdmin...");
            GenericResponse <bool> authResponse = RPCClient.Methods.Authenticate("SuperAdmin", ServerInfo.SuperAdminPassword);

            if (!authResponse.Erroneous && authResponse.Value)
            {
                Log("Authentication successfull!");

                Log("Trying to enable callbacks...");
                GenericResponse <bool> enableCallbacksResponse = RPCClient.Methods.EnableCallbacks(true);

                if (!enableCallbacksResponse.Erroneous && enableCallbacksResponse.Value)
                {
                    Log("Callbacks enabled successfully!");

                    Action doWork = OnDoWork;
                    Dispatcher.Invoke(doWork, null);
                }
                else
                {
                    Log("Could not enable callbacks!");
                    RPCClient.Disconnect();
                }
            }
            else
            {
                Log("Authentication failed!");
                RPCClient.Disconnect();
            }
        }
예제 #2
0
        private void CloseInternal()
        {
            DetachEvents();

            if (RPCClient.IsConnected)
            {
                RPCClient.Disconnect();
            }

            if (Close != null)
            {
                Close(this, EventArgs.Empty);
            }
        }