Esempio n. 1
0
    void OnGUI()
    {
        GUILayout.BeginArea(new Rect(Screen.width / 2 - 150, Screen.height / 2 - 100, 300, 300));
        GUILayout.BeginVertical();
        GUI.skin = Myskin;

        if (GUILayout.Button("FACEBOOK CONNECT", GUILayout.Height(70), GUILayout.Width(300)))
        {
            LoadingMessage.SetMessage("Connecting To Facebook...");
            FacebookService.ConnectWithFacebook();
        }

        if (GUILayout.Button("GLOBAL LEADERBOARD", GUILayout.Height(70), GUILayout.Width(300)))
        {
            LoadingMessage.SetMessage("Please Wait...");
            FBLeaderBoard.GlobalLeaderBoard();
        }

        if (GUILayout.Button("QUIT", GUILayout.Height(70), GUILayout.Width(300)))
        {
            Application.Quit();
        }
        GUILayout.EndVertical();
        GUILayout.EndArea();
    }
Esempio n. 2
0
    public void OnSuccess(object response)
    {
        if (response is string)
        {
            LoadingMessage.newMessage = "SuccessFully Connected With Facebook";

            LeaderBoardCallBack.fbAccessToken = response.ToString();
            LeaderBoardCallBack.isConnected   = true;
            Application.LoadLevel("GameScene");
        }

        if (response is Game)
        {
            Game gameObj = (Game)response;
            Debug.Log("Game ::: " + gameObj.ToString());
            if (fromLeaderBoard)
            {
                if (gameObj.GetScoreList().Count > 0)
                {
                    for (int i = 0; i < gameObj.GetScoreList().Count; i++)
                    {
                        int    currentDetails = gameObj.GetScoreList()[i].GetJsonDocList().Count - 1;
                        string score          = gameObj.GetScoreList()[i].GetValue().ToString();
                        string jsonDoc        = gameObj.GetScoreList()[i].GetJsonDocList()[currentDetails].GetJsonDoc();
                        var    parser         = SimpleJSON.JObject.Parse(jsonDoc);
                        string profilePic     = parser["profilePic"];
                        string userId         = parser["userId"];
                        string name           = parser["name"];
                        Texture.GetInstance().ExecuteShow(userId, profilePic);

                        Debug.Log("userId ::: " + name);

                        IList <string> slist1 = new List <string>();
                        slist1.Add(userId);
                        slist1.Add(name);
                        slist1.Add(profilePic);
                        slist1.Add(score);
                        fList.Add(slist1);
                    }
                }
                fromLeaderBoard = false;
                Application.LoadLevel("LeaderBoardScene");
            }
            if (fromSaveScore)
            {
                LoadingMessage.SetMessage("Score SuccessFully Saved.");
                //fromSaveScore = false;
            }
        }
        if (response is com.shephertz.app42.paas.sdk.csharp.social.Social)
        {
            com.shephertz.app42.paas.sdk.csharp.social.Social socialObj = (com.shephertz.app42.paas.sdk.csharp.social.Social)response;
            Debug.Log("Social :: " + socialObj.ToString());
            LeaderBoardCallBack.fbUserName       = socialObj.GetFacebookProfile().GetName();
            LeaderBoardCallBack.fbUserProfilePic = socialObj.GetFacebookProfile().GetPicture();
            LeaderBoardCallBack.fbUserId         = socialObj.GetFacebookProfile().GetId();
            //	FBUserConnect.isConnected = false;
        }
    }
    public string RunCommandWithLoadingMessage(string command)
    {
        // Show the message to tell the user the command is loading
        LoadingMessage lm = new LoadingMessage();

        lm.Show();
        string result = RunCommand(command, 0);

        lm.Close();
        return(result);
    }
Esempio n. 4
0
 public void NotifyMe(LoadingMessage message)
 {
     if (message.Behavior == LoadingScreenBehavior.Show)
     {
         ShowRootLoading = true;
     }
     else
     {
         ShowRootLoading = false;
     }
 }
 private void OnLoadingMessage(LoadingMessage message)
 {
     if (message.Loading)
     {
         ProgressBarVisibility = true;
         _running++;
         _dispatcherTimerHandle = _systemServices.StartTimer(OnTick, TimeSpan.FromSeconds(2), true);
     }
     else
     {
         _running--;
     }
 }
Esempio n. 6
0
        private static void CreateLoadingMessage()
        {
            string newMessage = "";

            if (_loadingMessages.Count == 1)
            {
                newMessage = "Loading: " + _loadingMessages[0];
            }
            else if (_loadingMessages.Count > 1)
            {
                newMessage = "Loading...";
            }
            LoadingMessage?.Invoke(null, newMessage);
        }
	public void OnSuccess (object response)
	{

		if (response is Game){
			Game gameObj = (Game)response;
			Debug.Log("Game ::: "+gameObj.ToString());
			if (fromLeaderBoard){
				if(gameObj.GetScoreList().Count > 0){
					for (int i=0; i<gameObj.GetScoreList().Count; i++){
						string name = gameObj.GetScoreList()[i].GetFacebookProfile().GetName();
						string score = gameObj.GetScoreList()[i].GetValue().ToString();
						string jsonDoc = gameObj.GetScoreList()[i].GetJsonDocList()[0].GetJsonDoc();
						var parser = SimpleJSON.JObject.Parse(jsonDoc);
						string profilePic = parser["profilePic"];
						string userId = parser["userId"];
						Texture.GetInstance().ExecuteShow(name, profilePic);
						
						Debug.Log("userId ::: " + userId);
						
						IList<string> slist1 = new List<string>();
					//	slist1.Add(userId);
						slist1.Add(name);
						slist1.Add(profilePic);
						slist1.Add(score);
						fList.Add(slist1);
					}
				}
				fromLeaderBoard = false;
				Application.LoadLevel("LeaderBoardScene");
			}
			if (fromSaveScore){
				LoadingMessage.SetMessage("Score SuccessFully Saved.");
				//fromSaveScore = false;
			}
			
		}

	}
 private void HandleLoadingMessage(LoadingMessage msg)
 {
     IsBusy = msg.IsLoading;
 }
        public async void AddFileToList(object message)
        {
            // Create OpenFileDialog 
            Microsoft.Win32.OpenFileDialog dialog = new Microsoft.Win32.OpenFileDialog();

            // Set filter for file extension and default file extension 
            dialog.DefaultExt = ".nbib";
            dialog.Filter = "Text Files (*.txt)|*.txt|Medline Files (*.nbib)|*.nbib";

            // Display OpenFileDialog by calling ShowDialog method 
            Nullable<bool> result = dialog.ShowDialog();

            // TODO!!! the duplicate filtering should be SEPARATE from the UI logic!!!
            if (result == true)
            {
                if (!string.IsNullOrWhiteSpace(dialog.FileName))
                {
                    if (!SelectedFiles.Where(file => file.FullPath.Equals(dialog.FileName)).Any())
                    {
                        IListableFileViewModel loadingMessage = new LoadingMessage { FullPath = " - LOADING - PLEASE WAIT -", NumberOfCitations = 0 };
                        try
                        {

                            var slowTask = Task<MedlineFileViewModel>.Factory.StartNew(() => CreateMedlineFileViewModel(dialog.FileName));

                            SelectedFiles.Add(loadingMessage);

                            await slowTask;

                            MedlineFileViewModel fileViewModel = slowTask.Result;

                            SelectedFiles.Remove(loadingMessage);

                            SelectedFiles.Add(fileViewModel);
                            TotalCitationNumber += fileViewModel.NumberOfCitations;
                            foreach (CitationViewModel citation in fileViewModel.Citations)
                            {
                                if (!UniqueCitations.ContainsKey(citation.Id))
                                {
                                    UniqueCitations[citation.Id] = citation;
                                    List<MedlineFileViewModel> containers = new List<MedlineFileViewModel>() { fileViewModel };
                                    CitationsContainers[citation.Id] = containers;
                                }
                                else
                                {
                                    // add the fileViewModel to the existing citation
                                    CitationsContainers[citation.Id].Add(fileViewModel);
                                }
                            }

                            UniqueCitationNumber = UniqueCitations.Count;
                            // say article A appears in file1, file2 and file3
                            // then it should be counted 2 times as duplicate
                            DuplicateCitationNumber = CitationsContainers
                                .Where(pair => pair.Value.Count > 1)
                                .Sum(pair => (pair.Value.Count -1));
                        }
                        catch (Exception ex) 
                        {
                            ShowError(WrongFileFormatMessage);
                            SelectedFiles.Remove(loadingMessage);
                        }
                    }
                    else
                    {
                        ShowError("Already added that file...");
                    }
                }
            }
        }
Esempio n. 10
0
	// Use this for initialization
	void Start () {
		
		this.anim = this.GetComponent<Animator>();
		Active = this;
		
	}
Esempio n. 11
0
 private void BackFunction(LoadingMessage obj)
 {
     CurrentView = new ProfesoriWindow(new ProfesoriWindowViewModel(App.UtilizatorCurent.Id));
 }