async void SaveOrUpdateProfile() { if (string.IsNullOrEmpty(Host)) { SettingProfileEditMessage = "Please enter a valid host address."; return; } if (_port == 0) { SettingProfileEditMessage = "Please enter a valid port number."; return; } if (SelectedProfile != _con.CurrentProfile) { if (SelectedProfile == null) { Profile pro = new Profile(); _selectedProfile = pro; } SelectedProfile.Name = Host + ":" + Port; _selectedProfile.Host = Host; _selectedProfile.Port = _port; _selectedProfile.Password = Password; Profiles.Add(SelectedProfile); _con.CurrentProfile = SelectedProfile; } else { _con.CurrentProfile.Name = Host + ":" + Port; _con.CurrentProfile.Host = Host; _con.CurrentProfile.Port = _port; _con.CurrentProfile.Password = Password; } _con.SaveProfile(); _mpc.MpdHost = _con.CurrentProfile.Host; _mpc.MpdPort = _con.CurrentProfile.Port; _mpc.MpdPassword = _con.CurrentProfile.Password; //IsBusy = true; SettingProfileEditMessage = "Connecting to " + Host + ":" + _port.ToString() + "..."; ConnectionResult ret = await _mpc.MpdConnect(); if (ret.isSuccess) { SettingProfileEditMessage = "Success!" + Environment.NewLine + "Waiting for OK from the MPD..."; } else { SettingProfileEditMessage = "Error connecting: " + ret.errorMessage; } }
private async void OnConnectClicked() { _mpc.MpdHost = Host; _mpc.MpdPort = _port; _mpc.MpdPassword = Password; IsBusy = true; ConnectionStatus = "Connecting to " + Host + ":" + _port.ToString() + "..."; ConnectionResult ret = await _mpc.MpdConnect(); if (ret.isSuccess) { ConnectionStatus = "Success!" + Environment.NewLine + "Waiting for OK from the MPD..."; } else { ConnectionStatus = "Error connecting: " + ret.errorMessage; } }