async void GetSchedule() { try { // Get the schedule asychronously osVodigiWS.osVodigiServiceSoapClient ws = new osVodigiWS.osVodigiServiceSoapClient(); ws.Endpoint.Address = new System.ServiceModel.EndpointAddress(new Uri(PlayerConfiguration.configVodigiWebserviceURL)); osVodigiWS.Player_GetCurrentScheduleResponse scheduleResponse = await ws.Player_GetCurrentScheduleAsync(PlayerConfiguration.configPlayerID); string xml = scheduleResponse.Body.Player_GetCurrentScheduleResult; if (xml.StartsWith("<xml><Error>")) { throw new Exception("Error"); } ScheduleFile.SaveScheduleFile(xml); CurrentSchedule.ClearSchedule(); CurrentSchedule.LastScheduleXML = xml; CurrentSchedule.ParseScheduleXml(xml); // Also copies the PlayerSettings to Helpers.PlayerSettings // At this point, the schedule has been retrieved, so go to the Download control FadeOut(); } catch { DisplayErrorCondition(); } }
private void btnWebServerSave_Click(object sender, RoutedEventArgs e) { try { lblWebServerValidate.Text = String.Empty; osVodigiWS.osVodigiServiceSoapClient ws = new osVodigiWS.osVodigiServiceSoapClient(); if (!txtWebServiceURL.Text.ToLower().StartsWith("http://")) { lblWebServerValidate.Text = "The Vodigi Web Service URL must begin with http://"; return; } try { ws.Endpoint.Address = new System.ServiceModel.EndpointAddress(new Uri(txtWebServiceURL.Text.Trim())); osVodigiWS.UserAccount useraccount = ws.User_Validate("defaultusername", "defaultpassword"); } catch { lblWebServerValidate.Text = "The Vodigi Web Service URL is not valid."; return; } if (!txtMediaSourceURL.Text.ToLower().StartsWith("http://")) { lblMediaSourceURL.Text = "The Media Source URL must begin with http://"; return; } if (!txtMediaSourceURL.Text.EndsWith("/")) { txtMediaSourceURL.Text = txtMediaSourceURL.Text + "/"; } try { WebRequest request = WebRequest.Create(txtMediaSourceURL.Text + "DONOTDELETE.txt"); WebResponse response = request.GetResponse(); if (response == null) { throw new Exception("Invalid"); } } catch { lblWebServerValidate.Text = "The Media Source URL is not valid."; return; } //Utility.SaveWebserviceURL(txtWebServiceURL.Text.Trim()); //Utility.SaveAppSetting("MediaSourUrl", txtMediaSourceURL.Text.Trim()); MessageBox.Show("The settings were saved successfully.", "Save", MessageBoxButton.OK, MessageBoxImage.Information); } catch { } }
private void RegisterClicked() { try { lblError.Text = String.Empty; if (String.IsNullOrEmpty(txtAccountName.Text.Trim()) || String.IsNullOrEmpty(txtPlayerName.Text.Trim())) { lblError.Text = "Please enter Account and Player Names."; return; } osVodigiWS.osVodigiServiceSoapClient ws = new osVodigiWS.osVodigiServiceSoapClient(); ws.Endpoint.Address = new System.ServiceModel.EndpointAddress(new Uri(PlayerConfiguration.configVodigiWebserviceURL)); // Validate the account osVodigiWS.Account account = ws.Account_GetByName(txtAccountName.Text.Trim()); if (account == null) { lblError.Text = "Invalid Account Name. Please retry."; return; } PlayerConfiguration.configAccountID = account.AccountID; PlayerConfiguration.configAccountName = account.AccountName; // Validate the player osVodigiWS.Player player = ws.Player_GetByName(account.AccountID, txtPlayerName.Text.Trim()); if (player == null) { lblError.Text = "Invalid Player Name. Please retry."; return; } PlayerConfiguration.configPlayerID = player.PlayerID; PlayerConfiguration.configPlayerName = player.PlayerName; // Set the remaining properties on PlayerConfiguration and save the configuration PlayerConfiguration.configIsPlayerInitialized = true; PlayerConfiguration.SavePlayerConfiguration(); // Since registration can cause accountid/playerid changes, delete the local schedule file ScheduleFile.DeleteScheduleFile(); // Register the player at vodigi.com try { VodigiWS.VodigiWSSoapClient vws = new VodigiWS.VodigiWSSoapClient(); vws.PlayerRegistered("PlayerRegistration"); } catch { } FadeOut(); } catch { lblError.Text = "Cannot connect to Vodigi Server. Please retry."; } }
private void SaveQuestionData() { try { osVodigiWS.osVodigiServiceSoapClient ws = new osVodigiWS.osVodigiServiceSoapClient(); ws.Endpoint.Address = new System.ServiceModel.EndpointAddress(new Uri(PlayerConfiguration.configVodigiWebserviceURL)); // Save the data if (iAnsweredSurveyID == 0) { // Create the answered survey try { iAnsweredSurveyID = ws.AnsweredSurvey_Create(PlayerConfiguration.configAccountID, dsSurvey.SurveyID, PlayerConfiguration.configPlayerID); } catch { return; } } if (stackQuestion.Children.Count > 0) { // Skip the first item since it's the text label for (int i = 1; i < stackQuestion.Children.Count; i += 1) { try { int iSurveyID = dsSurvey.SurveyID; int iQuestionID = dsSurveyQuestions[iQuestionIndex].SurveyQuestionID; int iSurveyQuestionOptionID = 0; bool bIsSelected = false; if (dsSurveyQuestions[iQuestionIndex].AllowMultiselect) { CheckBox checkbox = (CheckBox)stackQuestion.Children[i]; iSurveyQuestionOptionID = Convert.ToInt32(checkbox.Tag); bIsSelected = Convert.ToBoolean(checkbox.IsChecked); } else { RadioButton radiobutton = (RadioButton)stackQuestion.Children[i]; iSurveyQuestionOptionID = Convert.ToInt32(radiobutton.Tag); bIsSelected = Convert.ToBoolean(radiobutton.IsChecked); } // Update the answered survey question option try { ws.AnsweredSurveyQuestionOption_CreateAsync(iAnsweredSurveyID, iSurveyQuestionOptionID, bIsSelected); } catch { } } catch { } } } } catch { } }
private void VerifyClicked() { string errortext = "URL is invalid. Please try again."; try { // Try to get the database version at the url specified osVodigiWS.osVodigiServiceSoapClient ws = new osVodigiWS.osVodigiServiceSoapClient(); ws.Endpoint.Address = new System.ServiceModel.EndpointAddress(new Uri(txtVodigiWebserviceURL.Text.Trim())); osVodigiWS.DatabaseVersion version = ws.DatabaseVersion_Get(); if (version == null) { lblError.Text = errortext; } else { PlayerConfiguration.configVodigiWebserviceURL = txtVodigiWebserviceURL.Text.Trim(); FadeOut(); } } catch { lblError.Text = errortext; } }
public void Test_DatabaseVersion_Get() { osVodigiWS.osVodigiServiceSoapClient ws = new osVodigiWS.osVodigiServiceSoapClient(); osVodigiWS.DatabaseVersion version = ws.DatabaseVersion_Get(); }
public void Player_GetCurrentSchedule() { osVodigiWS.osVodigiServiceSoapClient ws = new osVodigiWS.osVodigiServiceSoapClient(); string schedulexml = ws.Player_GetCurrentSchedule(1000000); }
async void GetSchedule() { try { // Get the schedule asychronously osVodigiWS.osVodigiServiceSoapClient ws = new osVodigiWS.osVodigiServiceSoapClient(); ws.Endpoint.Address = new System.ServiceModel.EndpointAddress(new Uri(Utility.GetWebserviceURL())); osVodigiWS.Player_GetCurrentScheduleResponse scheduleResponse = await ws.Player_GetCurrentScheduleAsync(PlayerConfiguration.configPlayerID); string xml = scheduleResponse.Body.Player_GetCurrentScheduleResult; if (xml.StartsWith("<xml><Error>")) throw new Exception("Error"); ScheduleFile.SaveScheduleFile(xml); CurrentSchedule.ClearSchedule(); CurrentSchedule.LastScheduleXML = xml; CurrentSchedule.ParseScheduleXml(xml); // At this point, the schedule has been retrieved, so go to the Download control FadeOut(); } catch { DisplayErrorCondition(); } }
private void RegisterClicked() { try { lblError.Text = String.Empty; if (String.IsNullOrEmpty(txtAccountName.Text.Trim()) || String.IsNullOrEmpty(txtPlayerName.Text.Trim())) { lblError.Text = "Please enter Account and Player Names."; return; } osVodigiWS.osVodigiServiceSoapClient ws = new osVodigiWS.osVodigiServiceSoapClient(); ws.Endpoint.Address = new System.ServiceModel.EndpointAddress(new Uri(PlayerConfiguration.configVodigiWebserviceURL)); // Validate the account osVodigiWS.Account account = ws.Account_GetByName(txtAccountName.Text.Trim()); if (account == null) { lblError.Text = "Invalid Account Name. Please retry."; return; } PlayerConfiguration.configAccountID = account.AccountID; PlayerConfiguration.configAccountName = account.AccountName; // Validate the player osVodigiWS.Player player = ws.Player_GetByName(account.AccountID, txtPlayerName.Text.Trim()); if (player == null) { lblError.Text = "Invalid Player Name. Please retry."; return; } PlayerConfiguration.configPlayerID = player.PlayerID; PlayerConfiguration.configPlayerName = player.PlayerName; // Set the remaining properties on PlayerConfiguration and save the configuration PlayerConfiguration.configIsPlayerInitialized = true; PlayerConfiguration.SavePlayerConfiguration(); // Since registration can cause accountid/playerid changes, delete the local schedule file ScheduleFile.DeleteScheduleFile(); // Register the player at vodigi.com try { VodigiWS.VodigiWSSoapClient vws = new VodigiWS.VodigiWSSoapClient(); vws.PlayerRegistered("PlayerRegistration"); } catch { } FadeOut(); } catch { lblError.Text = "Cannot connect to Vodigi Server. Please retry."; } }
private void SaveQuestionData() { try { osVodigiWS.osVodigiServiceSoapClient ws = new osVodigiWS.osVodigiServiceSoapClient(); ws.Endpoint.Address = new System.ServiceModel.EndpointAddress(new Uri(Utility.GetWebserviceURL())); // Save the data if (iAnsweredSurveyID == 0) { // Create the answered survey try { iAnsweredSurveyID = ws.AnsweredSurvey_Create(PlayerConfiguration.configAccountID, dsSurvey.SurveyID, PlayerConfiguration.configPlayerID); } catch { return; } } if (stackQuestion.Children.Count > 0) { // Skip the first item since it's the text label for (int i = 1; i < stackQuestion.Children.Count; i += 1) { try { int iSurveyID = dsSurvey.SurveyID; int iQuestionID = dsSurveyQuestions[iQuestionIndex].SurveyQuestionID; int iSurveyQuestionOptionID = 0; bool bIsSelected = false; if (dsSurveyQuestions[iQuestionIndex].AllowMultiselect) { CheckBox checkbox = (CheckBox)stackQuestion.Children[i]; iSurveyQuestionOptionID = Convert.ToInt32(checkbox.Tag); bIsSelected = Convert.ToBoolean(checkbox.IsChecked); } else { RadioButton radiobutton = (RadioButton)stackQuestion.Children[i]; iSurveyQuestionOptionID = Convert.ToInt32(radiobutton.Tag); bIsSelected = Convert.ToBoolean(radiobutton.IsChecked); } // Update the answered survey question option try { ws.AnsweredSurveyQuestionOption_CreateAsync(iAnsweredSurveyID, iSurveyQuestionOptionID, bIsSelected); } catch { } } catch { } } } } catch { } }
private void GetFilesToDownload() { try { osVodigiWS.osVodigiServiceSoapClient ws = new osVodigiWS.osVodigiServiceSoapClient(); // Set the web service url ws.Endpoint.Address = new System.ServiceModel.EndpointAddress(new Uri(PlayerConfiguration.configVodigiWebserviceURL)); string xml = ws.Player_GetMediaToDownload(PlayerConfiguration.configAccountID); downloads = new List<Download>(); images = new List<Image>(); videos = new List<Video>(); musics = new List<Music>(); XDocument xmldoc = XDocument.Parse(xml); images = (from Image in xmldoc.Descendants("Image") select new Image { ImageID = Convert.ToInt32(Image.Attribute("ImageID").Value), StoredFilename = Convert.ToString(Image.Attribute("StoredFilename").Value), ImageName = Utility.DecodeXMLString(Image.Attribute("ImageName").Value), } ).ToList(); videos = (from Video in xmldoc.Descendants("Video") select new Video { VideoID = Convert.ToInt32(Video.Attribute("VideoID").Value), StoredFilename = Convert.ToString(Video.Attribute("StoredFilename").Value), VideoName = Utility.DecodeXMLString(Video.Attribute("VideoName").Value) } ).ToList(); musics = (from Music in xmldoc.Descendants("Music") select new Music { MusicID = Convert.ToInt32(Music.Attribute("MusicID").Value), StoredFilename = Convert.ToString(Music.Attribute("StoredFilename").Value), MusicName = Utility.DecodeXMLString(Music.Attribute("MusicName").Value), } ).ToList(); foreach (Image image in images) { Download download = new Download(); download.FileType = "Image"; download.StoredFilename = image.StoredFilename; downloads.Add(download); } foreach (Video video in videos) { Download download = new Download(); download.FileType = "Video"; download.StoredFilename = video.StoredFilename; downloads.Add(download); } foreach (Music music in musics) { Download download = new Download(); download.FileType = "Music"; download.StoredFilename = music.StoredFilename; downloads.Add(download); } } catch { } }
private void btnWebServerSave_Click(object sender, RoutedEventArgs e) { try { lblWebServerValidate.Text = String.Empty; osVodigiWS.osVodigiServiceSoapClient ws = new osVodigiWS.osVodigiServiceSoapClient(); if (!txtWebServiceURL.Text.ToLower().StartsWith("http://")) { lblWebServerValidate.Text = "The Vodigi Web Service URL must begin with http://"; return; } try { ws.Endpoint.Address = new System.ServiceModel.EndpointAddress(new Uri(txtWebServiceURL.Text.Trim())); osVodigiWS.UserAccount useraccount = ws.User_Validate("defaultusername", "defaultpassword"); } catch { lblWebServerValidate.Text = "The Vodigi Web Service URL is not valid."; return; } if (!txtMediaSourceURL.Text.ToLower().StartsWith("http://")) { lblMediaSourceURL.Text = "The Media Source URL must begin with http://"; return; } if (!txtMediaSourceURL.Text.EndsWith("/")) txtMediaSourceURL.Text = txtMediaSourceURL.Text + "/"; try { WebRequest request = WebRequest.Create(txtMediaSourceURL.Text + "DONOTDELETE.txt"); WebResponse response = request.GetResponse(); if (response == null) throw new Exception("Invalid"); } catch { lblWebServerValidate.Text = "The Media Source URL is not valid."; return; } Utility.SaveWebserviceURL(txtWebServiceURL.Text.Trim()); Utility.SaveAppSetting("MediaSourUrl", txtMediaSourceURL.Text.Trim()); MessageBox.Show("The settings were saved successfully.", "Save", MessageBoxButton.OK, MessageBoxImage.Information); } catch { } }
private void GetFilesToDownload() { try { osVodigiWS.osVodigiServiceSoapClient ws = new osVodigiWS.osVodigiServiceSoapClient(); // Set the web service url ws.Endpoint.Address = new System.ServiceModel.EndpointAddress(new Uri(PlayerConfiguration.configVodigiWebserviceURL)); string xml = ws.Player_GetMediaToDownload(PlayerConfiguration.configAccountID); downloads = new List <Download>(); images = new List <Image>(); videos = new List <Video>(); musics = new List <Music>(); XDocument xmldoc = XDocument.Parse(xml); images = (from Image in xmldoc.Descendants("Image") select new Image { ImageID = Convert.ToInt32(Image.Attribute("ImageID").Value), StoredFilename = Convert.ToString(Image.Attribute("StoredFilename").Value), ImageName = Utility.DecodeXMLString(Image.Attribute("ImageName").Value), } ).ToList(); videos = (from Video in xmldoc.Descendants("Video") select new Video { VideoID = Convert.ToInt32(Video.Attribute("VideoID").Value), StoredFilename = Convert.ToString(Video.Attribute("StoredFilename").Value), VideoName = Utility.DecodeXMLString(Video.Attribute("VideoName").Value) } ).ToList(); musics = (from Music in xmldoc.Descendants("Music") select new Music { MusicID = Convert.ToInt32(Music.Attribute("MusicID").Value), StoredFilename = Convert.ToString(Music.Attribute("StoredFilename").Value), MusicName = Utility.DecodeXMLString(Music.Attribute("MusicName").Value), } ).ToList(); foreach (Image image in images) { Download download = new Download(); download.FileType = "Image"; download.StoredFilename = image.StoredFilename; downloads.Add(download); } foreach (Video video in videos) { Download download = new Download(); download.FileType = "Video"; download.StoredFilename = video.StoredFilename; downloads.Add(download); } foreach (Music music in musics) { Download download = new Download(); download.FileType = "Music"; download.StoredFilename = music.StoredFilename; downloads.Add(download); } } catch { } }
private void VerifyClicked() { string errortext = "URL is invalid. Please try again."; try { // Try to get the database version at the url specified osVodigiWS.osVodigiServiceSoapClient ws = new osVodigiWS.osVodigiServiceSoapClient(); ws.Endpoint.Address = new System.ServiceModel.EndpointAddress(new Uri(txtVodigiWebserviceURL.Text.Trim())); osVodigiWS.DatabaseVersion version = ws.DatabaseVersion_Get(); if (version == null) { lblError.Text = errortext; } else { PlayerConfiguration.configVodigiWebserviceURL = txtVodigiWebserviceURL.Text.Trim(); FadeOut(); } } catch { lblError.Text = errortext; } }