private void PasswordCheck_Unchecked(object sender, RoutedEventArgs e) { MessageBoxResult result = MessageBox.Show("Do you want remove password .??", "Alert", MessageBoxButton.YesNo); if (result == MessageBoxResult.Yes) { if (PasswordBox.Password != null || PasswordBox.Password != "") { string old_pwd = Interaction.InputBox("Please give your old password", "Change password", "Old password"); XmlDocument xd = new XmlDocument(); SecurityPW sc = new SecurityPW(); xd.Load("UserSettings.xml"); string old_pssd = sc.Decryptstring(xd.SelectSingleNode("UserProfile/General/Password").InnerText); if (old_pssd == old_pwd) { PasswordBox.Password = ""; PasswordBox.IsEnabled = false; ChangePassword.IsEnabled = false; } else { System.Windows.MessageBox.Show("You entered wrong password!!"); PasswordCheck.IsChecked = true; PasswordBox.IsEnabled = false; } } } else { PasswordCheck.IsChecked = true; PasswordBox.IsEnabled = false; } }
private void Button_Click(object sender, RoutedEventArgs e) { System.Xml.XmlDocument xd = new System.Xml.XmlDocument(); xd.Load(path); SecurityPW security = new SecurityPW(); if (PasswordBoxLogin.Password == security.Decryptstring(xd.SelectSingleNode("UserProfile/General/Password").InnerText)) { new MainWindow().Show(); this.Close(); } else { MessageBox.Show("Wrong Password entered"); } }
private void ChangePassword_Click(object sender, RoutedEventArgs e) { string old_pwd = Interaction.InputBox("Please give your old password", "Change password", "Old password"); XmlDocument xd = new XmlDocument(); SecurityPW sc = new SecurityPW(); xd.Load("UserSettings.xml"); string old_pssd = sc.Decryptstring(xd.SelectSingleNode("UserProfile/General/Password").InnerText); if (old_pssd.Equals(old_pwd)) { string new_pwd = Interaction.InputBox("Please give your new password", "Change password", "New password"); PasswordBox.Password = new_pwd; xd.SelectSingleNode("UserProfile/General/Password").InnerText = sc.Encryptstring(new_pwd); xd.Save("UserSettings.xml"); } else { PasswordBox.IsEnabled = false; System.Windows.MessageBox.Show("You entered wrong password!!"); } }
public Settings(MainWindow mw) { this.mw = mw; mw.Settings.IsEnabled = false; InitializeComponent(); General.IsExpanded = true; // sharedFiles = new Dictionary<CheckBox,string>(); VirtualName = new Dictionary <string, string>(); childs = new Dictionary <string, List <string> >(); if (File.Exists(mainPath + "UserSettings.xml") == true) { String key = NickName.Text; XmlDocument settings = new XmlDocument(); settings.Load(mainPath + "UserSettings.xml"); NickName.Text = settings.SelectSingleNode("UserProfile/General/NickName").InnerText; GroupName.Text = settings.SelectSingleNode("UserProfile/General/GroupName").InnerText; if (settings.SelectSingleNode("UserProfile/General/passwordenabled").InnerText == "yes") { PasswordCheck.IsChecked = true; ChangePassword.IsEnabled = true; security = new SecurityPW(); PasswordBox.Password = security.Decryptstring(settings.SelectSingleNode("UserProfile/General/Password").InnerText); PasswordBox.IsEnabled = false; } else { PasswordCheck.IsChecked = false; ChangePassword.IsEnabled = false; PasswordBox.IsEnabled = false; } Camera.SelectedItem = settings.SelectSingleNode("UserProfile/Conference/Camera").InnerText; Microphone.SelectedItem = settings.SelectSingleNode("UserProfile/Conference/Microphone").InnerText; pic_path.Text = settings.SelectSingleNode("UserProfile/Appearance/ProfilepicPath").InnerText; AudioSave_path.Text = settings.SelectSingleNode("UserProfile/Conference/Audiosavepath").InnerText; if (pic_path.Text != null & pic_path.Text != "") { try { Uri uri = new Uri(@pic_path.Text, UriKind.Absolute); ImageSource imgSource = new BitmapImage(uri); Profile_pic.Source = imgSource; } catch (Exception e) { MessageBox.Show(e.Message); } } else { string strUri2 = "pack://application:,,,/Images/user-icon.png"; Profile_pic.Source = new BitmapImage(new Uri(strUri2)); } String colour = settings.SelectSingleNode("UserProfile/Appearance/Colour").InnerText; Color color = (Color)ColorConverter.ConvertFromString(colour); ColorPicker.SelectedColor = color; BrushConverter bc = new BrushConverter(); this.Background = (Brush)bc.ConvertFrom(colour); RadialGradientBrush rgb = new RadialGradientBrush(); rgb.RadiusY = 0.75; Point p = new Point(0.5, 0); rgb.Center = p; rgb.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString(colour), 1)); rgb.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#BFFFFFFF"), 0)); this.Background = rgb; if (settings.SelectSingleNode("UserProfile/BlockedList/Block_Games").InnerText == "Yes") { Receive_Games.IsChecked = true; } else { Receive_Games.IsChecked = false; } if (settings.SelectSingleNode("UserProfile/BlockedList/Block_Study").InnerText == "Yes") { Receive_Study.IsChecked = true; } else { Receive_Study.IsChecked = false; } if (settings.SelectSingleNode("UserProfile/BlockedList/Block_Others").InnerText == "Yes") { Receive_others.IsChecked = true; } else { Receive_others.IsChecked = false; } if (settings.SelectSingleNode("UserProfile/BlockedList/Send_Default").InnerText == "Games") { Send_Games.IsChecked = true; } else if (settings.SelectSingleNode("UserProfile/BlockedList/Send_Default").InnerText == "Study") { Send_Study.IsChecked = true; } else if (settings.SelectSingleNode("UserProfile/BlockedList/Send_Default").InnerText == "Others") { Send_Others.IsChecked = true; } else { Send_Games.IsChecked = false; Send_Study.IsChecked = false; Send_Others.IsChecked = false; } foreach (XmlNode user in settings.SelectNodes("UserProfile/BlockedList/Users/Blockeduser")) { BlockedList.Items.Add(user.InnerText); listOfBlock.Add(IPAddress.Parse(user.InnerText)); } } else { NickName.Text = ""; GroupName.Text = ""; PasswordCheck.IsChecked = false; PasswordBox.IsEnabled = false; ChangePassword.IsEnabled = false; Camera.Text = ""; Microphone.Text = ""; Recording.IsChecked = true; AudioSave_path.Text = ""; ColorPicker.SelectedColor = (Color)ColorConverter.ConvertFromString("#FF6E6969"); string strUri2 = "pack://application:,,,/Images/user-icon.png"; Profile_pic.Source = new BitmapImage(new Uri(strUri2)); RadialGradientBrush rgb = new RadialGradientBrush(); rgb.RadiusY = 0.75; Point p = new Point(0.5, 0); rgb.Center = p; rgb.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#BF919191"), 1)); rgb.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#BFFFFFFF"), 0)); this.Background = rgb; } FilterInfoCollection cam = new FilterInfoCollection(FilterCategory.VideoInputDevice); { foreach (FilterInfo info in cam) { Camera.Items.Add(info.Name); } } Audio aw = new Audio(); foreach (var i in aw.sources) { Microphone.Items.Add(i.ProductName); } foreach (var i in UserList.GroupList.Values.Distinct()) { GroupName.Items.Add(i); } if (File.Exists("Sharing.xml")) { loadSharedFolders(); } loadUser(); }