public void HandleCallback(CallbackMsg msg) { if (msg.IsType <SteamUser.LoginKeyCallback>()) { GetClient().Friends.SetPersonaState(EPersonaState.Online); Friend.Me = new Friend(GetClient().User.GetSteamID()); Friend.Me.Name = "me"; SteamAlerts.ShowToast("Connected to Steam"); } else if (msg.IsType <SteamUser.LogOnCallback>()) { SteamUser.LogOnCallback callback = (SteamUser.LogOnCallback)msg; if (callback.Result == EResult.OK) { EnableAutoReconnect(); } else { DisableAutoReconnect(); } } else if (msg.IsType <SteamFriends.FriendMsgCallback>()) { SteamFriends.FriendMsgCallback callback = (SteamFriends.FriendMsgCallback)msg; if (callback.EntryType == EChatEntryType.ChatMsg) { Friend friend = Friend.GetFriendBySteamId(callback.Sender.ToString()); if (friend != activeChat) { Intent intent = new Intent(SteamAlerts.GetContext(), typeof(Chat)); intent.SetAction("chat_notification_" + DateTime.Now.Ticks); intent.PutExtra("steam_id", friend.SteamId.ToString()); SteamAlerts.Notification("Message from " + friend.Name, friend.Name + ": " + callback.Message, callback.Message, intent, "steam_id", friend.SteamId.ToString()); SteamAlerts.PlaySound(); SteamAlerts.Vibrate(400); } } } else if (msg.IsType <SteamClient.ConnectCallback>()) { SteamAlerts.Notification("Steam Droid", "Connected to Steam", "Connected to Steam", new Intent(SteamAlerts.GetContext(), typeof(Main)), null, null); } else if (msg.IsType <SteamClient.DisconnectCallback>()) { SteamAlerts.Notification("Steam Droid", "Disconnected from Steam", "Connected to Steam", new Intent(SteamAlerts.GetContext(), typeof(Main)), null, null); SteamAlerts.ShowToast("Disconnected from Steam"); } }
/// <summary> /// Processes the callbacks received from the callback thread /// </summary> /// <param name='msg'> /// Message. /// </param> public void ProcessCallback(CallbackMsg msg) { if (msg.IsType <SteamClient.ConnectCallback>()) { user.LogOn(new SteamUser.LogOnDetails() { Username = username, Password = password, AuthCode = authcode }); /* * timeout = TimeoutHandler.Start(10000, () => * { * Disconnect(); * * if (retry < 2) * { * Connect(); * * retry++; * } * else * { * retry = 0; * } * * return null; * });*/ } if (msg.IsType <SteamClient.DisconnectCallback>() || msg.IsType <SteamUser.LoggedOffCallback>()) { loggedIn = false; } if (msg.IsType <SteamUser.LogOnCallback>()) { SteamUser.LogOnCallback callback = (SteamUser.LogOnCallback)msg; if (callback.Result == EResult.OK) { loggedIn = true; authcode = null; retry = 0; /* * if (timeout != null) * { * timeout.Cancel(true); * }*/ /* * Friends.SetPersonaState(EPersonaState.Online); * * Friend.Me = new Friend(User.GetSteamID()); * Friend.Me.Name = "me"; * * SteamAlerts.ShowToast("Connected to Steam"); * SteamAlerts.Notification("SteamDroid", "Connected to Steam", "Connected to Steam", new Android.Content.Intent(SteamAlerts.GetContext(), typeof(App.Main)), null, null); */ } } if (msg.IsType <SteamUser.LoginKeyCallback>()) { Friends.SetPersonaState(EPersonaState.Online); Friend.Me = new Friend(User.GetSteamID()); Friend.Me.Name = "me"; SteamAlerts.ShowToast("Connected to Steam"); SteamAlerts.Notification("SteamDroid", "Connected to Steam", "Connected to Steam", new Android.Content.Intent(SteamAlerts.GetContext(), typeof(App.Main)), null, null); } Push(msg); }