private void buttonViewProfile_Click(object sender, RoutedEventArgs e)
        {
            ProfileWindow profileWindow = new ProfileWindow();

            profileWindow.Show();
            this.Close();
        }
Example #2
0
 /// <summary>
 /// Any user Profile window
 /// </summary>
 /// <param name="profileWindowOpen">opens the window</param>
 /// <param name="userProfile">user</param>
 public ProfileViewModel(ProfileWindow profileWindowOpen, tblUser userProfile)
 {
     user          = userProfile;
     profileWindow = profileWindowOpen;
     PostList      = postData.GetAllUserPosts(userProfile).ToList();
     ViewPost      = Visibility.Collapsed;
 }
Example #3
0
        private void Authorization()
        {
            string login    = LoginTextBox.Text.TrimEnd(new char[] { ' ' });
            string password = User.GetHash(MainPasswordBox.Password);

            var user = _storage.Users.Items.FirstOrDefault(u => u.Login == login && password == u.Password);

            if (user == null)
            {
                MessageBox.Show("Введенной пары логина и пароля не найдено в базе. Попробуйте еще раз либо обратитесь к разработчикам!", "Ошибка");

                LoginTextBox.Text       = "";
                LoginTextBox.Foreground = Brushes.Black;

                PasswordTextBox.Visibility = Visibility.Visible;
                MainPasswordBox.Visibility = Visibility.Hidden;

                MainPasswordBox.Password = "";

                LoginTextBox.Focus();
            }

            else
            {
                ProfileWindow profileWindow = new ProfileWindow(user);

                profileWindow.Show();

                Close();
            }
        }
Example #4
0
 private void SignInButtonClick(object sender, RoutedEventArgs e)
 {
     using (var context = new Context(Constants.ConnectionString))
     {
         var service = new AuthService(context);
         var user    = new User();
         if (emailTextBox.Text.Length == 0 || passwordTextBox.Password.Length == 0)
         {
             MessageBox.Show("Введите данные!");
         }
         else
         {
             user = service.SignIn(emailTextBox.Text, passwordTextBox.Password);
             if (user is null)
             {
                 MessageBox.Show("Неправильный email или пароль!");
             }
             else
             {
                 var window = new ProfileWindow(user);
                 this.Close();
                 window.Show();
             }
         }
     }
 }
Example #5
0
        private void UserAvatarHover_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            ProfileWindow profile = new ProfileWindow(this.player.User);

            profile.Owner = gameTable.Window;
            profile.Show();
        }
 /// <summary>
 /// Remove a profile property.
 /// </summary>
 /// <param name="variableId">The id of the property.</param>
 public void RemoveValue(string variableId)
 {
     foreach (var pro in m_Profiles)
     {
         pro.values.RemoveAll(x => x.id == variableId);
     }
     m_ProfileEntryNames.RemoveAll(x => x.Id == variableId);
     SetDirty(AddressableAssetSettings.ModificationEvent.ProfileModified, null, false);
     ProfileWindow.MarkForReload();
 }
        // Allows passing in the profile directly for internal methods, makes the profile window's code a bit cleaner
        // Can't be public since BuildProfile is an internal class
        internal bool RenameProfile(BuildProfile profile, string newName)
        {
            if (profile == null)
            {
                Addressables.LogError("Profile rename failed because profile passed in is null");
                return(false);
            }

            if (profile == GetDefaultProfile())
            {
                Addressables.LogError("Profile rename failed because default profile cannot be renamed.");
                return(false);
            }

            if (profile.profileName == newName)
            {
                return(false);
            }

            // new name cannot only contain spaces
            if (newName.Trim().Length == 0)
            {
                Addressables.LogError("Profile rename failed because new profile name must not be only spaces.");
                return(false);
            }


            bool profileExistsInSettingsList = false;

            for (int i = 0; i < m_Profiles.Count; i++)
            {
                // return false if there already exists a profile with the new name, no duplicates are allowed
                if (m_Profiles[i].profileName == newName)
                {
                    Addressables.LogError("Profile rename failed because new profile name is not unique.");
                    return(false);
                }

                if (m_Profiles[i].id == profile.id)
                {
                    profileExistsInSettingsList = true;
                }
            }

            // Rename the profile
            profile.profileName = newName;

            if (profileExistsInSettingsList)
            {
                SetDirty(AddressableAssetSettings.ModificationEvent.ProfileModified, profile, true);
            }

            ProfileWindow.MarkForReload();
            return(true);
        }
 /// <summary>
 /// Removes a profile.
 /// </summary>
 /// <param name="profileId">The id of the profile to remove.</param>
 public void RemoveProfile(string profileId)
 {
     m_Profiles.RemoveAll(p => p.id == profileId);
     m_Profiles.ForEach(p => { if (p.inheritedParent == profileId)
                               {
                                   p.inheritedParent = null;
                               }
                        });
     SetDirty(AddressableAssetSettings.ModificationEvent.ProfileRemoved, profileId, true);
     ProfileWindow.MarkForReload();
 }
        private void ProfileButton_Click(object sender, RoutedEventArgs e)
        {
            ProfileWindow profileWindow = new ProfileWindow((int)InformationAboutCurrnetUser.UserId);

            if (profileWindow.ShowDialog() == true)
            {
                LogOutOnGoogle();
                InformationAboutCurrnetUser.NullAllSettings();
                AuthorizationWindow authorization = new AuthorizationWindow();
                authorization.Show();
                this.Close();
            }
        }
Example #10
0
        private void ProfileMenuItem_Click(object sender, RoutedEventArgs e)
        {
            ProfileWindow profileWindow = new ProfileWindow(mainViewModel);

            profileWindow.Owner = this;

            if (profileWindow.ShowDialog() == false)
            {
                if (profileWindow.getProfileViewModel() != null)
                {
                    mainViewModel = profileWindow.getProfileViewModel();
                }
            }
        }
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (_showingTheRubric)
            {
                RubricWindow rubricWindow = new RubricWindow(_rubricShown, _userWhoWatches);

                rubricWindow.Show();
            }
            else
            {
                ProfileWindow profileWindow = new ProfileWindow(_userWhoWatches);

                profileWindow.Show();
            }
        }
Example #12
0
        /// <summary>
        /// Executes the Profile
        /// </summary>
        private void ProfileExecute()
        {
            try
            {
                List <tblRelationship> allRelationships = userData.GetAllRelationshipsUsers(LoggedInUser.CurrentUser).ToList();
                List <tblUser>         allUsers         = userData.GetAllUsers().ToList();
                int           relationshipUserID        = 0;
                ProfileWindow profileWindow;

                if (PandingUser != null)
                {
                    for (int i = 0; i < allRelationships.Count; i++)
                    {
                        if (PandingUser.RelationshipID == allRelationships[i].RelationshipID)
                        {
                            // Check the name of the person that is the current logged in users friend
                            if (allRelationships[i].User1ID != LoggedInUser.CurrentUser.UserID)
                            {
                                relationshipUserID = allRelationships[i].User1ID;
                            }
                            else
                            {
                                relationshipUserID = allRelationships[i].User2ID;
                            }
                        }
                    }

                    for (int i = 0; i < allUsers.Count; i++)
                    {
                        if (allUsers[i].UserID == relationshipUserID)
                        {
                            profileWindow = new ProfileWindow(allUsers[i]);
                            profileWindow.ShowDialog();
                        }
                    }
                }
                else
                {
                    profileWindow = new ProfileWindow(User);
                    profileWindow.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                Xceed.Wpf.Toolkit.MessageBox.Show("Cannot open user profile right now, please try again later." + ex);
            }
        }
Example #13
0
        void HandleRosterItemMenuTriggered(QAction action)
        {
            // FIXME: Actions should be handled in the controller.

            if (m_MenuDownItem == null)
            {
                return;
            }

            if (action == m_ViewProfileAction)
            {
                var window = new ProfileWindow(m_MenuDownItem.Account, m_MenuDownItem.Item.JID);
                window.Show();
            }
            else if (action == m_IMAction)
            {
                Gui.TabbedChatsWindow.StartChat(m_MenuDownItem.Account, m_MenuDownItem.Item.JID);
            }
            else if (m_InviteActions.Contains(action))
            {
                foreach (Room room in m_MenuDownItem.Account.ConferenceManager.Rooms)
                {
                    if (room.JID.Bare == action.Text)
                    {
                        Console.WriteLine("Invite: " + m_MenuDownItem.Item.JID);
                        room.Invite(m_MenuDownItem.Item.JID, String.Empty);
                        return;
                    }
                }
            }
            else if (action == m_EditGroupsAction)
            {
                var win = new EditGroupsWindow(m_MenuDownItem.Account, m_MenuDownItem.Item);
                win.Show();
            }
            else if (action == m_RemoveAction)
            {
                if (QMessageBox.Question(this.TopLevelWidget(), "Synapse", "Are you sure you want to remove this friend?", (uint)QMessageBox.StandardButton.Yes | (uint)QMessageBox.StandardButton.No) == QMessageBox.StandardButton.Yes)
                {
                    m_MenuDownItem.Account.RemoveRosterItem(m_MenuDownItem.Item.JID);
                }
            }
        }
        /// <summary>
        /// Adds a new profile.
        /// </summary>
        /// <param name="name">The name of the new profile.</param>
        /// <param name="copyFromId">The id of the profile to copy values from.</param>
        /// <returns>The id of the created profile.</returns>
        public string AddProfile(string name, string copyFromId)
        {
            var existingProfile = GetProfileByName(name);

            if (existingProfile != null)
            {
                return(existingProfile.id);
            }
            var copyRoot = GetProfile(copyFromId);

            if (copyRoot == null && m_Profiles.Count > 0)
            {
                copyRoot = GetDefaultProfile();
            }
            var prof = new BuildProfile(name, copyRoot, this);

            m_Profiles.Add(prof);
            SetDirty(AddressableAssetSettings.ModificationEvent.ProfileAdded, prof, true);
            ProfileWindow.MarkForReload();
            return(prof.id);
        }
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (_goingBackToProfile)
            {
                ProfileWindow profileWindow = new ProfileWindow(_user);

                profileWindow.Show();
            }
            else if (_goingToEditPage)
            {
                ProfileWindow profileWindow = new ProfileWindow(_visitedUser, _user, true, _fullVersionShouldBeShown);

                profileWindow.Show();
            }
            else
            {
                ProfileWindow profileWindow = new ProfileWindow(_visitedUser, _user, _fullVersionShouldBeShown);

                profileWindow.Show();
            }
        }
Example #16
0
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (_goingToRead)
            {
                DocumentWindow documentWindow = new DocumentWindow(_documentForReading, false, false, true, _user, _userWhoWatches);

                documentWindow.Show();
            }
            else if (_userWhoWatches == null)
            {
                ProfileWindow profileWindow = new ProfileWindow(_user);

                profileWindow.Show();
            }
            else
            {
                ProfileWindow profileWindow = new ProfileWindow(_user, _userWhoWatches, false);

                profileWindow.Show();
            }
        }
Example #17
0
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (_goingToRead)
            {
                if (_lookingInTheDeveloperMode)
                {
                    DocumentWindow documentWindow = new DocumentWindow(_documentForReadingOrEditing, _userWhoWatches);

                    documentWindow.Show();
                }
                else
                {
                    DocumentWindow documentWindow = new DocumentWindow(_documentForReadingOrEditing);

                    documentWindow.Show();
                }
            }
            else if (_goingToEdit)
            {
                EditDocumentWindow editDocumentWindow = new EditDocumentWindow(_documentForReadingOrEditing, _userWhoWatches);

                editDocumentWindow.Show();
            }
            else
            {
                if (_lookingInTheDeveloperMode)
                {
                    ProfileWindow profileWindow = new ProfileWindow(_userWhoWatches);

                    profileWindow.Show();
                }
                else
                {
                    MainWindow mainWindow = new MainWindow();

                    mainWindow.Show();
                }
            }
        }
        /// <summary>
        /// Set the value of a variable for a specified profile.
        /// </summary>
        /// <param name="profileId">The profile id.</param>
        /// <param name="variableName">The property name.</param>
        /// <param name="val">The value to set the property.</param>
        public void SetValue(string profileId, string variableName, string val)
        {
            var profile = GetProfile(profileId);

            if (profile == null)
            {
                Addressables.LogError("setting variable " + variableName + " failed because profile " + profileId + " does not exist.");
                return;
            }

            var id = GetVariableId(variableName);

            if (string.IsNullOrEmpty(id))
            {
                Addressables.LogError("setting variable " + variableName + " failed because variable does not yet exist. Call CreateValue() first.");
                return;
            }

            profile.SetValueById(id, val);
            SetDirty(AddressableAssetSettings.ModificationEvent.ProfileModified, profile, true);
            ProfileWindow.MarkForReload();
        }
            internal void SetName(string newName, AddressableAssetProfileSettings ps)
            {
                if (!ps.ValidateNewVariableName(newName))
                {
                    return;
                }

                var currRefStr = "[" + m_Name + "]";
                var newRefStr  = "[" + newName + "]";

                m_Name = newName;

                foreach (var p in ps.profiles)
                {
                    foreach (var v in p.values)
                    {
                        v.value = v.value.Replace(currRefStr, newRefStr);
                    }
                }

                ps.SetDirty(AddressableAssetSettings.ModificationEvent.ProfileModified, null, false);
                ProfileWindow.MarkForReload();
            }
Example #20
0
        private void BtnSearch_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(viewModel.Platform))
            {
                return;
            }
            if (string.IsNullOrEmpty(viewModel.PlayerName))
            {
                return;
            }

            if (controller.GetPlayer(viewModel.Platform, viewModel.PlayerName))
            {
                //MessageBox.Show("OK");

                ProfileWindow profile = new ProfileWindow();
                profile.Show();
                this.Close();
            }
            else
            {
                MessageBox.Show("Player not found");
            }
        }
Example #21
0
        public Main()
        {
            InitializeComponent();

            // Logs autoscroll
            LogsTxt.TextChanged += delegate {
                LogsTxt.ScrollToEnd();
            };

            #region Profiles menu

            // Open menu
            MoreBtn.Click += delegate {
                // Translate items (don't work in XAML)
                CreateBtn.Header = Langs.Get("create_profile");
                RemoveBtn.Header = Langs.Get("remove_profile");

                MoreBtn.ContextMenu.IsOpen = true;
            };

            // Create | Remove
            CreateBtn.Click += delegate {
                // Profile informations
                string _ProfilePath = Utils.GetValidFileID(true, Reference.ProfilesPath, Langs.Get("default_profile_name"), 0);
                string _ProfileName = Path.GetFileNameWithoutExtension(_ProfilePath);

                // Create profile
                Directory.CreateDirectory(_ProfilePath);
                ProfilesCombo.Items.Add(new ListBoxItem()
                {
                    Content = _ProfileName
                });

                // Select profile
                Profiles.Select(_ProfileName);
            };
            RemoveBtn.Click += delegate {
                // Confirmation
                if (MessageBox.Show(Langs.Get("remove_profile_confirm"), Reference.AppName, MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
                {
                    // Remove profile
                    Directory.Delete(Profiles.GetProfilePath(), true);
                    // Refresh
                    Profiles.RefreshList(false);
                }
            };

            #endregion

            #region Top menu

            EditProfileBtn.Click += delegate {
                string _ProfileName = Profiles.GetProfile();

                // A profile is selected
                if (_ProfileName != null)
                {
                    // Profile exist
                    if (Profiles.Exist(_ProfileName))
                    {
                        // Disable recognition
                        Boolean _Rec = SpeechRecognition.State;
                        SpeechRecognition.State = false;

                        // Window
                        ProfileWindow _ProfileWindow = new ProfileWindow(_ProfileName);
                        _ProfileWindow.ShowDialog();

                        // Recognition
                        SpeechRecognition.State = _Rec;
                    }
                    else
                    {
                        Utils.Log(string.Format(Langs.Get("profile_doesnt_exist"), _ProfileName));
                        Profiles.RefreshList(false);
                    }
                }
                else
                {
                    Utils.Log(string.Format(Langs.Get("no_profile")));
                    Profiles.RefreshList(false);
                }
            };

            SettingsBtn.Click += delegate {
                // Window
                SettingsWindow _Settings = new SettingsWindow();
                _Settings.ShowDialog();
            };

            MicrophoneBtn.Click += delegate {
                // If profile has commands
                if (Profiles.GetProfileCommands().Count() > 0)
                {
                    // Switch microphone state
                    SpeechRecognition.State = !SpeechRecognition.State;
                    Utils.Log(Langs.Get((SpeechRecognition.State) ? "microphone_enabled" : "microphone_disabled"));
                }
                else
                {
                    Utils.Log(Langs.Get("microphone_no_commands"));
                }
            };

            StopCommandsBtn.Click += delegate {
                // Stop text to speech
                Classes.Recognition.Synthesizer.SpeechSynthesizer.SpeakAsyncCancelAll();
                Utils.Log(Langs.Get("commands_stopped"));
            };

            #endregion
        }
        private void ProfileContainer_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            ProfileWindow pw = new ProfileWindow();

            pw.ShowDialog();
        }