private void manageConnectionProfileLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { var mgr = new ConnectionProfileManager(_profileManager); mgr.ShowDialog(); RefreshConnectionProfiles(); }
async void GetProfileListAsync() { var list = await ConnectionProfileManager.GetProfileListAsync(ProfileListType.Connected); profiles.Clear(); foreach (var result in list) { switch (result.Type) { case ConnectionProfileType.Bt: profiles.Add(ConnectionProfile.Bluetooth); break; case ConnectionProfileType.Cellular: profiles.Add(ConnectionProfile.Cellular); break; case ConnectionProfileType.Ethernet: profiles.Add(ConnectionProfile.Ethernet); break; case ConnectionProfileType.WiFi: profiles.Add(ConnectionProfile.WiFi); break; } } OnConnectivityChanged(); }
private void LoadProfileNames(string defaultValue = null) { string type = this.cboDbType.Text; if (type != "") { IEnumerable <ConnectionProfileInfo> profiles = ConnectionProfileManager.GetProfiles(type); List <string> names = profiles.Select(item => item.Name).ToList(); this.cboDbProfile.DataSource = profiles.ToList(); this.cboDbProfile.DisplayMember = nameof(ConnectionProfileInfo.Description); this.cboDbProfile.ValueMember = nameof(ConnectionProfileInfo.Name); if (string.IsNullOrEmpty(defaultValue)) { if (profiles.Count() > 0) { this.cboDbProfile.SelectedIndex = 0; } } else { if (names.Contains(defaultValue)) { this.cboDbProfile.Text = profiles.FirstOrDefault(item => item.Name == defaultValue)?.Description; } } bool selected = this.cboDbProfile.Text.Length > 0; this.btnConfigDbProfile.Visible = this.btnDeleteDbProfile.Visible = selected; } }
private void LoadProfile() { ConnectionInfo connectionInfo = ConnectionProfileManager.GetConnectionInfo(this.DatabaseType.ToString(), this.ProflieName); this.ucDbAccountInfo.LoadData(connectionInfo, this.ConnectionInfo?.Password); this.cboDatabase.Text = connectionInfo.Database; }
/// <summary> /// Gets interface name about currently connected profile /// </summary> /// <returns>String with interface name of currently connected profile</returns> public string GetCurrentProfileInterfaceName() { currProfile = ConnectionProfileManager.GetCurrentProfile(); if (currProfile == null) { Logger.Log("There is no current profile"); return(""); } return(currProfile.InterfaceName); }
public static async void SetUpMaxSpeed() { var list = await ConnectionProfileManager.GetProfileListAsync(ProfileListType.Registered); foreach (var item in list) { _connectionProfile = item; break; } _wiFiProfile = (WiFiProfile)_connectionProfile; }
private void DeleteProfile() { DialogResult dialogResult = MessageBox.Show("Are you sure to delete the profile?", "Confirm", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { string profileName = (this.cboDbProfile.SelectedItem as ConnectionProfileInfo).Name; if (ConnectionProfileManager.Delete(this.DatabaseType, profileName)) { this.LoadProfileNames(); } } }
private void GetConnectionInfoByProfile() { DatabaseType dbType = this.DatabaseType; string profileName = (this.cboDbProfile.SelectedItem as ConnectionProfileInfo)?.Name; ConnectionInfo connectionInfo = ConnectionProfileManager.GetConnectionInfo(dbType.ToString(), profileName); if (connectionInfo != null) { if (this.OnSelectedChanged != null) { this.OnSelectedChanged(this, connectionInfo); } } }
/// <summary> /// Calls ConnectionProfileManager.GetProfileListAsync() to get profile list /// and create a list that contains Connection Profile information /// </summary> /// <returns>ProfileInfo list</returns> private async void GetProfileListAsync() { profileInfoList = await ConnectionProfileManager.GetProfileListAsync(ProfileListType.Registered); }
private void btnConfirm_Click(object sender, EventArgs e) { if (!this.ucDbAccountInfo.ValidateInfo()) { return; } if (string.IsNullOrEmpty(this.cboDatabase.Text)) { MessageBox.Show("Please select a database."); return; } string profileName = this.txtProfileName.Text.Trim(); string database = this.cboDatabase.Text; this.ConnectionInfo = this.GetConnectionInfo(); if (!this.NotUseProfile) { IEnumerable <ConnectionProfileInfo> profiles = ConnectionProfileManager.GetProfiles(this.DatabaseType.ToString()); Guid?oldAccountProfileId = null; if (!string.IsNullOrEmpty(profileName) && profiles.Any(item => item.Name == profileName)) { string msg = $"The profile name \"{profileName}\" has been existed"; if (this.isAdd) { DialogResult dialogResult = MessageBox.Show(msg + ", are you sure to override it.", "Confirm", MessageBoxButtons.YesNo); if (dialogResult != DialogResult.Yes) { this.DialogResult = DialogResult.None; return; } } else if (!this.isAdd && this.ProflieName != profileName) { MessageBox.Show(msg + ", please edit that."); return; } else //edit { oldAccountProfileId = profiles.FirstOrDefault(item => item.Name == profileName).AccountProfileId; } } ConnectionProfileInfo profile = new ConnectionProfileInfo() { ConnectionInfo = this.ConnectionInfo }; if (oldAccountProfileId.HasValue) { profile.AccountProfileId = oldAccountProfileId.Value; } profile.Name = profileName; profile.DatabaseType = this.DatabaseType.ToString(); this.ProflieName = ConnectionProfileManager.Save(profile, this.ucDbAccountInfo.RememberPassword); } this.DialogResult = DialogResult.OK; }
/// <summary> /// Gets the list of the profile /// </summary> private async void GetProfileList() { // Call Tizen C# API profileList = await ConnectionProfileManager.GetProfileListAsync(ProfileListType.Registered); }