Exemplo n.º 1
0
        private void renameButton_Click(object sender, EventArgs e)
        {
            ProfileHolder ph = (ProfileHolder)namesBox.SelectedItem;

            ph.name = nameBox.Text;

            EnableDisable();
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="profile"></param>
        public ProfileOptionsViewModel(ProfileHolder profile)
        {
            _groupsViewModel = new GroupsViewModel(profile.Groups, profile.Name, RootModel.AllActionDescriptions);
            Profile          = profile;

            EditOptionsCommand   = new DelegateCommand(EditProfile, true);
            ImportProfileCommand = new DelegateCommand(ImportProfile, true);
        }
Exemplo n.º 3
0
        private void addButton_Click(object sender, EventArgs e)
        {
            dynamic item = new ProfileHolder(nameBox.Text);

            profiles.Add(item);
            namesBox.SelectedItem = item;
            EnableDisable();
        }
Exemplo n.º 4
0
        /// <summary>
        /// Save current history to settings
        /// </summary>
        public void SaveCurrentHistory(ProfileHolder profile)
        {
            profile.CommandsHistory.Clear();

            lock (_enteredCommandsQueue)
            {
                profile.CommandsHistory.AddRange(_enteredCommandsQueue.ToArray());
            }
        }
Exemplo n.º 5
0
        public static MessageConveyor CreateNew(string model, ProfileHolder profile, IList <RootModel> allRootModels)
        {
            var result    = new MessageConveyor(new MccpClient());
            var rootModel = new RootModel(result, profile, allRootModels);

            allRootModels.Add(rootModel);
            result.RootModel = rootModel;
            return(result);
        }
Exemplo n.º 6
0
 //----------------------------------------ACCOUNT (We send OnFailed too to keep the possibility to identify an error on the user-side. We could upgrade this part)
 public void StartLogin()
 {
     if (!PlayerPrefs.HasKey(KEY_ID) || !PlayerPrefs.HasKey(KEY_PWD) || !ProfileHolder.IsEmail(PlayerPrefs.GetString(KEY_ID)) || !IsRegisteredEmail)
     {
         LoginAnonymously();
     }
     else
     {
         SignIn(PlayerPrefs.GetString(KEY_ID), PlayerPrefs.GetString(KEY_PWD));
     }
 }
Exemplo n.º 7
0
    private void OnRecover()
    {
        if (!ProfileHolder.IsEmail(emailInput.text))
        {
            HintItIsNotEmail();
            Debug.LogWarning("Need a real email to recover");
            return;
        }

        HintCantRecoveredPassword(); //TO DELETE IF WE USE A REAL API KEY (registered with no 2FA and with a debit card)
        CloudManager.Instance.Profile.ResetPassword(emailInput.text, OnRecovered, OnFailedRecovered);
    }
        private void RunShell()
        {
            ProfileSelector selector = new ProfileSelector();

            if (selector.ShowDialog() == DialogResult.OK)
            {
                var profileHolder = new ProfileHolder();
                profileHolder.Current = selector.CurrentProfile;
                container.RegisterInstance(typeof(IProfileHolder), profileHolder);

                Application.Run(container.Resolve <MainForm>());
            }
        }
Exemplo n.º 9
0
    private void Awake()
    {
        if (instance)
        {
            Debug.LogError("Already a Singleton ! " + typeof(CloudManager).ToString() + " in " + this.gameObject.name + " and i am in " + instance.gameObject.name);
            Destroy(this.gameObject);
            return;
        }

        instance     = (CloudManager)this;
        profile      = new ProfileHolder(this);
        leaderboards = new LeaderboardsHolder(this);
    }
Exemplo n.º 10
0
        public RootModel(ProfileHolder profile)
        {
            _name             = profile.Name;
            _aliasList        = new List <CommandAlias>();
            _triggersList     = new List <TriggerBase>();
            _highlightList    = new List <Highlight>();
            _substitutionList = new List <Substitution>();
            _hotkeyList       = new List <Hotkey>();
            _variableList     = new List <Variable>();

            _undoStack = new Stack <IUndo>();

            _profile = profile;

            GroupStatus        = new List <CharacterStatus>();
            RoomMonstersStatus = new List <MonsterStatus>();
        }
Exemplo n.º 11
0
        /// <summary>
        /// Load command's history from profile.
        /// </summary>
        /// <param name="profile"></param>
        public void LoadHistory(ProfileHolder profile)
        {
            lock (_enteredCommandsQueue)
            {
                var history = profile.CommandsHistory;

                if (history.Count > _queueSize)
                {
                    _enteredCommandsQueue = profile.CommandsHistory.GetRange(_queueSize, profile.CommandsHistory.Count);
                }
                else
                {
                    _enteredCommandsQueue.AddRange(profile.CommandsHistory);
                    _enteredCommandsQueue.Capacity = _queueSize;
                }

                _currentQueueElementIndex = _enteredCommandsQueue.Count;
            }
        }
Exemplo n.º 12
0
    //SignIn Results (For security, I think it's useless to have a splitted behaviour to know if this email is registered. But I would like to show that it's possible to)
    private void OnSuccessSignIn(string _id, string _pwd)
    {
        if (ProfileHolder.IsEmail(_id))
        {
            PlayerPrefs.SetInt(ProfileHolder.KEY_NETWORK, 1);
        }
        else
        {
            PlayerPrefs.SetInt(ProfileHolder.KEY_NETWORK, 0);
        }

        PlayerPrefs.SetString(ProfileHolder.KEY_ID, _id);
        PlayerPrefs.SetString(ProfileHolder.KEY_PWD, _pwd);
        PlayerPrefs.Save();

        cachedMail = _id;
        cachedPass = _pwd;

        ChangeState(WindowState.Connected);
        CloseWindow();
    }
Exemplo n.º 13
0
        public RootModel([NotNull] MessageConveyor conveyor, ProfileHolder profile, IList <RootModel> allModels)
        {
            Assert.ArgumentNotNull(conveyor, "conveyor");

            _aliasList        = new List <CommandAlias>();
            _triggersList     = new List <TriggerBase>();
            _highlightList    = new List <Highlight>();
            _substitutionList = new List <Substitution>();
            _hotkeyList       = new List <Hotkey>();
            _variableList     = new List <Variable>();

            _undoStack = new Stack <IUndo>();

            _name           = profile.Name;
            _profile        = profile;
            _allModels      = allModels;
            MessageConveyor = conveyor;

            GroupStatus        = new List <CharacterStatus>();
            RoomMonstersStatus = new List <MonsterStatus>();

            SettingsHolder.Instance.ProfilesChanged += OnProfileChanged;
        }
Exemplo n.º 14
0
 public void LoadHistory(ProfileHolder profile)
 {
     txtCommandInput.LoadHistory(profile);
 }
Exemplo n.º 15
0
 public void SaveCurrentHistory(ProfileHolder profile)
 {
     txtCommandInput.SaveCurrentHistory(profile);
 }
Exemplo n.º 16
0
    private void OnValidation()
    {
        if (!ProfileHolder.IsEmail(emailInput.text))
        {
            HintItIsNotEmail();
            ShakeCourriel();
            return;
        }

        switch (currentState)
        {
        case WindowState.SignIn:

            if (passwordInput.text != "" && ProfileHolder.IsPassword(passwordInput.text))
            {
                CloudManager.Instance.Profile.SignIn(emailInput.text, passwordInput.text, OnSuccessSignIn, FailedSignIn);
            }
            else
            {
                CloudManager.Instance.Profile.SignIn(emailInput.text, PlayerPrefs.GetString(ProfileHolder.KEY_PWD), OnSuccessSignIn, FailedSignIn);
            }

            //Automatic accound creation (I don't want this but it's possible like this)
            //CloudManager.Instance.Profile.LoginWithEmail(emailInput.text, passwordInput.text, OnFinishedMailAndPasswordEditing, OnFailedSignIn);
            break;

        case WindowState.SignUp:
            if (passwordInput.text != cachedPass)    //Has changed his password
            {
                if (ProfileHolder.IsPassword(passwordInput.text))
                {
                    CloudManager.Instance.Profile.SignUp(emailInput.text, passwordInput.text, OnFinishedMailAndPasswordEditing, OnNoRegisteredEmail);
                }
                else
                {
                    HintItIsNotAPassword();
                    ShakePadlock();
                }
            }
            else     //Has not changed his password in forms
            {
                if (ProfileHolder.IsPassword(PlayerPrefs.GetString(ProfileHolder.KEY_PWD)))
                {
                    CloudManager.Instance.Profile.SignUp(emailInput.text, PlayerPrefs.GetString(ProfileHolder.KEY_PWD), OnFinishedMailAndPasswordEditing, OnAlreadyRegisteredEmail);
                }
                else
                {
                    ShakePadlock();
                    Debug.LogError("The user has changed is password not properly ??");
                }
            }
            break;

        default:     //Connected
            if (emailInput.text != cachedMail)
            {
                CloudManager.Instance.Profile.ChangeEmail(emailInput.text, OnFinishedMailEditingAndChangeState);
            }

            if (passwordInput.text != PlayerPrefs.GetString(ProfileHolder.KEY_PWD) && ProfileHolder.IsPassword(passwordInput.text))
            {
                CloudManager.Instance.Profile.ChangePassword(passwordInput.text, OnFinishedPasswordEditingAndChangeState);
            }
            break;
        }
    }