static void Main(string[] args) { Video video1 = new Video(); Video video2 = new Video(); //Request video1.Link = "https://www.youtube.com/watch?v=IKRVX3c8HuU"; video2.Link = "https://www.facebook.com/watch/?v=361268888540894"; //Handlers YoutubHandler youtubHandler = new YoutubHandler(); FacebookHandler facebookHandler = new FacebookHandler(); InstagramHandler instagramHandler = new InstagramHandler(); //chain youtubHandler.setNextHandler(facebookHandler); facebookHandler.setNextHandler(instagramHandler); youtubHandler.HandleRequest(video2); Console.WriteLine(); Console.WriteLine(); facebookHandler.HandleRequest(video2); //Usages Console.WriteLine(); Console.WriteLine(); Console.WriteLine(); Console.WriteLine(); Console.WriteLine("--------------------------------------------------------------------"); Usages.tryCatchBloks(); Console.WriteLine(); Console.WriteLine(); }
//uses LUIS to understand user query inteligently, and respond appropriately private async Task <Activity> NaturalInteractionHandler(Activity message) { if ((message.Text.Trim().ToLower() ?? "") == "") { return(message.CreateReply("Error: Message type unsupported")); } LUISHandler.LUISQueryResult LUISResult = await LUISHandler.HandleQuery(message.Text); switch (LUISResult.responseType) { case LUISHandler.ResponseType.ExchangeRate: return(await ExchangeRateHandler.HandleExchangeRateMessage(message, LUISResult)); case LUISHandler.ResponseType.Logout: return(await FacebookHandler.LogoutHandler(message)); case LUISHandler.ResponseType.None: return(await UnknownHandler(message)); case LUISHandler.ResponseType.AccountBalance: return(await BankHandler.HandleBalance(message)); case LUISHandler.ResponseType.MakePayment: return(await BankHandler.HandleTransaction(message, LUISResult)); case LUISHandler.ResponseType.TransactionHistory: return(await BankHandler.HandleHistory(message)); default: return(message.CreateReply("Error: Unimplemented")); } }
//handle system messages, e.g. user joined private async Task <Activity> SystemMessageResponse(Activity message) { if (message.Type == ActivityTypes.DeleteUserData) { await FacebookHandler.LogoutHandler(message); } else if (message.Type == ActivityTypes.ConversationUpdate) { // Handle conversation state changes, like members being added and removed // Use Activity.MembersAdded and Activity.MembersRemoved and Activity.Action for info // Not available in all channels } else if (message.Type == ActivityTypes.ContactRelationUpdate) { // Handle add/remove from contact lists // Activity.From + Activity.Action represent what happened } else if (message.Type == ActivityTypes.Typing) { // Handle knowing tha the user is typing } else if (message.Type == ActivityTypes.Ping) { } return(null); }
void Start() { var starter = GameObject.FindObjectOfType <SceneStarter>(); if (starter != null) { //starter.Print(); if (starter.Content.IndexOf(',') > 0) { var monsterInfo = starter.Content; var monsterPosition = starter.MapPosition; LoadMonsterProfile(monsterInfo, monsterPosition); } else { if (_characterManager.UserPlayer.FBLoggedIn) { _facebook = FacebookHandler.Instance(); } var settings = _characterManager.CharacterSetting; var player = _characterManager.UserPlayer; var character = _characterManager.MyCharacter; LoadUserProfile(player, settings, character); } } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * Derived Method: Awake //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ protected override void Awake() { base.Awake(); if (!FB.IsInitialized) { FacebookHandler.InitialiseFacebook(); } }
public static FacebookHandler Instance() { if (!_facebook) { _facebook = FindObjectOfType(typeof(FacebookHandler)) as FacebookHandler; if (!_facebook) { Debug.LogWarning("#### There needs to be one active FacebookHandler script on a GameObject in your scene."); } } return(_facebook); }
void Start() { if (_characterManager.UserPlayer.FBLoggedIn) { _facebook = FacebookHandler.Instance(); } _playerPic = GameObject.Find("PlayerPic").GetComponent <Button>(); _characterPic = GameObject.Find("CharacterPic").GetComponent <Button>(); _characterName = GameObject.Find("CharacterName").GetComponent <TextMeshProUGUI>();; _characterPic.image.sprite = _characterManager.MyCharacter.GetSprite(); _characterName.text = _characterManager.CharacterSetting.Name; StartCoroutine("LoadProfilePicture"); }
// Use this for initialization void Awake() { if (_instance == null) { _instance = this; DontDestroyOnLoad(gameObject); Invoke("FbPauseAllow", 3.0f); CallFBInit(); } else { Destroy(gameObject); } }
void Start() { Debug.Log("***FB*** Start!"); _facebook = FacebookHandler.Instance(); _characterManager = CharacterManager.Instance(); if (!FB.IsInitialized) { FB.Init(SetInit, OnHideUnity); } else { FB.ActivateApp(); } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * Derived Method: Start //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ void Start() { #if !UNITY_EDITOR if (!FB.IsInitialized) { FacebookHandler.InitialiseFacebook(); } #else //const bool bFactoryReset = false; //if(bFactoryReset) //{ // PlayerPrefs.DeleteAll(); //} #endif }
//determine response to user message, i.e. text message private async Task <Activity> UserMessageResponse(Activity message) { if (!await FacebookHandler.IsAuthorised(message)) { return(await FacebookHandler.LoginHandler(message)); } else if (await IsPendingConfirmation(message)) { return(await ConfirmationHandler(message)); } else { return(await NaturalInteractionHandler(message)); } }
void Start() { var starter = GameObject.FindObjectOfType <SceneStarter>(); if (starter != null) { _menuSelector = starter.Content; } _facebook = FacebookHandler.Instance(); _loggedIn = GameObject.Find("FBLoggedIn"); _loggedOut = GameObject.Find("FBLoggedOut"); _menuSocial = GameObject.Find("MenuSocial"); _characterManager = CharacterManager.Instance(); _audioManager = AudioManager.Instance(); _desc = GameObject.Find("InputFieldDesc").GetComponent <TMP_InputField>(); _desc.text = _characterManager.UserPlayer.Description; _sound = GameObject.Find("SoundSlider").GetComponent <Slider>(); _sound.value = _characterManager.UserPlayer.SoundVolume; switch (_menuSelector) { case "Option": GameObject.Find("MenuMain").SetActive(false); GameObject.Find("MenuOption").SetActive(true); _menuSocial.SetActive(false); break; case "Social": GameObject.Find("MenuMain").SetActive(false); GameObject.Find("MenuOption").SetActive(false); _menuSocial.SetActive(true); break; default: GameObject.Find("MenuMain").SetActive(true); GameObject.Find("MenuOption").SetActive(false); _menuSocial.SetActive(false); break; } _username = GameObject.Find("Username").GetComponent <TextMeshProUGUI>(); _profilePicture = GameObject.Find("ProfilePicture").GetComponent <Image>(); _loggedIn.SetActive(false); _loggedOut.SetActive(false); }
//Handle message as a confirmation or response to a bot query private async Task <Activity> ConfirmationHandler(Activity message) { StateClient stateClient = message.GetStateClient(); BotData userData = await stateClient.BotState.GetUserDataAsync(message.ChannelId, message.From.Id); string pendingOn = userData.GetProperty <string>("Pending"); switch (pendingOn) { case "Transaction": return(await BankHandler.CompletePendingTransaction(message)); case "Logout": return(await FacebookHandler.HandlePendingLogout(message)); default: userData.SetProperty <string>("Pending", null); await stateClient.BotState.SetUserDataAsync(message.ChannelId, message.From.Id, userData); return(message.CreateReply("Something went wrong, please try again")); } }
public Task Execute(IJobExecutionContext context) { if (IsRunning) { return(default(Task)); } IsRunning = true; try { var userContext = new UserContext(); var unitOfWork = new UnitOfWork(userContext); var engineDataAccess = new EngineDataAccess(unitOfWork, userContext); var userData = engineDataAccess.GetUserDataForPull(); var response = new List <EngineLogResponse>(); foreach (var item in userData.Influencers) { foreach (var userInfluencer in userData.UserInfluencerAuths.Where(ui => ui.InfluencerId == item.InfluencerId).ToList()) { var itemResponse = new EngineLogResponse { UserId = userInfluencer.UserId, InfluencerId = (short)item.InfluencerId }; try { switch (item.InfluencerId) { case ConnectorType.Undefined: break; case ConnectorType.Google: var googleHandler = new GoogleHandler(); itemResponse.Response = googleHandler.Handle(item, userInfluencer); itemResponse.PullStatus = "Success"; break; case ConnectorType.Twitter: var twitterHandler = new TwitterHandler(); itemResponse.Response = twitterHandler.Handle(item, userInfluencer); itemResponse.PullStatus = "Success"; break; case ConnectorType.LinkedIn: var linkedinHandler = new LinkedInHandler(); itemResponse.Response = linkedinHandler.Handle(item, userInfluencer); itemResponse.PullStatus = "Success"; break; case ConnectorType.Upwork: break; case ConnectorType.Naukri: break; case ConnectorType.Payoneer: break; case ConnectorType.Paisabazaar: break; case ConnectorType.MCA: break; case ConnectorType.Facebook: var facebookHandler = new FacebookHandler(); itemResponse.Response = facebookHandler.Handle(item, userInfluencer); itemResponse.PullStatus = "Success"; break; default: break; } } catch (Exception ex) { itemResponse.Remarks = ex.ToString(); itemResponse.PullStatus = "Failed"; } finally { itemResponse.TransactionDate = DateTime.Now; } response.Add(itemResponse); } } engineDataAccess.UpdateEngineResponse(response); } catch (Exception ex) { throw; } finally { IsRunning = false; } return(default(Task)); }
protected void SetupFBObject() { fbObject = GameObject.Find ("fbObject"); if (fbObject != null) { facebookHandler = (FacebookHandler) fbObject.GetComponent(typeof(FacebookHandler)); } }