private void DeleteTournament(object obj) { if (!(obj is TournamentReportRecord tournament)) { return; } var notification = new PopupBaseNotification() { Title = CommonResourceManager.Instance.GetResourceString("Notifications_DeleteTournament_Title"), CancelButtonCaption = CommonResourceManager.Instance.GetResourceString("Notifications_DeleteHand_Cancel"), ConfirmButtonCaption = CommonResourceManager.Instance.GetResourceString("Notifications_DeleteHand_Yes"), Content = CommonResourceManager.Instance.GetResourceString("Notifications_DeleteTournament_Content"), IsDisplayH1Text = true }; PopupRequest.Raise(notification, confirmation => { if (confirmation.Confirmed) { var dataService = ServiceLocator.Current.GetInstance <IDataService>(); dataService.DeleteTournament(tournament.TournamentId, tournament.PokerSiteId); if (ReportSelectedItem != null) { ReportCollection.Remove(ReportSelectedItem); } eventAggregator.GetEvent <UpdateViewRequestedEvent>().Publish(new UpdateViewRequestedEventArgs { IsUpdateReportRequested = true }); } }); }
bool ILifeSpanHandler.OnBeforePopup(IWebBrowser browserControl, IBrowser browser, IFrame frame, string targetUrl, string targetFrameName, WindowOpenDisposition targetDisposition, bool userGesture, IPopupFeatures popupFeatures, IWindowInfo windowInfo, IBrowserSettings browserSettings, ref bool noJavascriptAccess, out IWebBrowser newBrowser) { //get url popup PopupRequest?.Invoke("https://tr1.seafight.com/index.es?action=internalMap"); //stop open popup window newBrowser = null; return(true); }
private void DeleteHands() { var handsToDelete = SelectedReportHands?.Select(x => new { x.GameNumber, x.PokerSiteId }).ToArray(); if (handsToDelete == null || handsToDelete.Length == 0) { return; } var notification = new PopupBaseNotification() { Title = handsToDelete.Length == 1 ? CommonResourceManager.Instance.GetResourceString("Notifications_DeleteHand_SingleTitle") : string.Format(CommonResourceManager.Instance.GetResourceString("Notifications_DeleteHand_MultipleTitle"), handsToDelete.Length), CancelButtonCaption = CommonResourceManager.Instance.GetResourceString("Notifications_DeleteHand_Cancel"), ConfirmButtonCaption = CommonResourceManager.Instance.GetResourceString("Notifications_DeleteHand_Yes"), Content = handsToDelete.Length == 1 ? CommonResourceManager.Instance.GetResourceString("Notifications_DeleteHand_SingleContent") : CommonResourceManager.Instance.GetResourceString("Notifications_DeleteHand_MultipleContent"), IsDisplayH1Text = true }; PopupRequest.Raise(notification, confirmation => { if (confirmation.Confirmed) { var dataservice = ServiceLocator.Current.GetInstance <IDataService>(); handsToDelete.ForEach(x => dataservice.DeleteHandHistory(x.GameNumber, x.PokerSiteId)); SelectedReportHands.ForEach(x => { ReportSelectedItemStatisticsCollection.Remove(x); ReportSelectedItem.ReportHands.Remove(x); StorageModel.RemoveStatistic(s => s.GameNumber == x.GameNumber && s.PokersiteId == x.PokerSiteId); }); eventAggregator.GetEvent <UpdateViewRequestedEvent>().Publish(new UpdateViewRequestedEventArgs { IsUpdateReportRequested = true }); } }); }
bool ILifeSpanHandler.OnBeforePopup(IWebBrowser browserControl, IBrowser browser, IFrame frame, string targetUrl, string targetFrameName, WindowOpenDisposition targetDisposition, bool userGesture, IPopupFeatures popupFeatures, IWindowInfo windowInfo, IBrowserSettings browserSettings, ref bool noJavascriptAccess, out IWebBrowser newBrowser) { //get url popup PopupRequest?.Invoke(targetUrl); //stop open popup window newBrowser = null; //return !EnablePopup; if (EnablePopup) { //browserControl.ExecuteScriptAsync("alert('test');"); OpenPopupInIframe(browserControl, targetUrl); } return(true); }
public bool OnBeforePopup(IWebBrowser browserControl, IBrowser browser, IFrame frame, string targetUrl, string targetFrameName, WindowOpenDisposition targetDisposition, bool userGesture, IPopupFeatures popupFeatures, IWindowInfo windowInfo, IBrowserSettings browserSettings, ref bool noJavascriptAccess, out IWebBrowser newBrowser) { newBrowser = null; PopupRequest?.Invoke(targetUrl); return(true); }
public bool OnBeforePopup(IWebBrowser browserControl, IBrowser browser, IFrame frame, string targetUrl, string targetFrameName, WindowOpenDisposition targetDisposition, bool userGesture, IPopupFeatures popupFeatures, IWindowInfo windowInfo, IBrowserSettings browserSettings, ref bool noJavascriptAccess, out IWebBrowser newBrowser) { if (browserControl.CanExecuteJavascriptInMainFrame) { PopupRequest?.Invoke(targetUrl); //Form_YB_NewTab form_newtab = new Form_YB_NewTab(targetUrl, "normal"); //int open_form = Application.OpenForms.Count; //if (open_form == 1) //{ // form_newtab.Show(); //} //else //{ // Form_YB_NewTab.SetClose = true; // form_newtab.Show(); //} // updated //MessageBox.Show(targetUrl); if (targetUrl.Contains("ambassador")) { Process.Start(targetUrl); } // comment else if (targetUrl.Contains("about:blank")) { browserControl.Load(targetUrl); //const string script = @"document.getElementById('depositAmount3Party').value;"; //browserControl.EvaluateScriptAsync(script).ContinueWith(x => //{ // var response = x.Result; // if (response.Success && response.Result != null) // { // var onePlusOne = (string)response.Result; // MessageBox.Show(onePlusOne.ToString()); // } //}); } else { Form_YB_NewTab form_newtab = new Form_YB_NewTab(targetUrl, "normal"); int open_form = Application.OpenForms.Count; if (open_form == 1) { form_newtab.Show(); } else { Form_YB_NewTab.SetClose = true; form_newtab.Show(); } } } newBrowser = null; return(true); }
private async Task ExportHandsTo3rdParty(HandExportInfo[] exportInfos) { var folderDialog = new FolderBrowserDialog(); var result = folderDialog.ShowDialog(); if (result != DialogResult.OK || !Directory.Exists(folderDialog.SelectedPath)) { return; } try { var sites = exportInfos .GroupBy(x => x.Site) .Select(x => x.Key) .ToArray(); var sitesInInternalFormat = sites .Where(x => x.IsStoredInInternalFormat()) .ToArray(); var useCommonExporter = false; if (sitesInInternalFormat.Length != 0) { var notification = new PopupBaseNotification() { Title = CommonResourceManager.Instance.GetResourceString("Notifications_ExportHands_ExportAsIPoker"), CancelButtonCaption = CommonResourceManager.Instance.GetResourceString("Notifications_ExportHands_ExportAsIPokerNo"), ConfirmButtonCaption = CommonResourceManager.Instance.GetResourceString("Notifications_ExportHands_ExportAsIPokerYes"), Content = CommonResourceManager.Instance.GetResourceString("Notifications_ExportHands_ExportAsIPokerContent"), IsDisplayH1Text = true }; PopupRequest.Raise(notification, confirmation => { useCommonExporter = !confirmation.Confirmed; }); } var handExportService = ServiceLocator.Current.GetInstance <IHandExportService>(); var mainViewModel = App.GetMainViewModel(); try { await handExportService.ExportHands(folderDialog.SelectedPath, exportInfos, mainViewModel?.ProgressViewModel.Progress, useCommonExporter); } finally { if (mainViewModel != null) { mainViewModel.ProgressViewModel.IsActive = false; mainViewModel.ProgressViewModel.Reset(); } } if (sitesInInternalFormat.Length != 0 && !useCommonExporter || sites.Any(x => x.IsStoredInIPokerFormat())) { var sitesInIPokerFormat = sitesInInternalFormat.Concat(sites.Where(x => x.IsStoredInIPokerFormat())); RaiseNotification( string.Format(CommonResourceManager.Instance.GetResourceString("Notifications_ExportHands_SuccessContentInInternalFormat"), string.Join("/", sitesInIPokerFormat.Select(x => CommonResourceManager.Instance.GetEnumResource(x)))), CommonResourceManager.Instance.GetResourceString("Notifications_ExportHands_SuccessTitle")); return; } RaiseNotification(CommonResourceManager.Instance.GetResourceString("Notifications_ExportHands_SuccessContent"), CommonResourceManager.Instance.GetResourceString("Notifications_ExportHands_SuccessTitle")); } catch (Exception e) { RaiseNotification(CommonResourceManager.Instance.GetResourceString("Notifications_ExportHands_FailedContent"), CommonResourceManager.Instance.GetResourceString("Notifications_ExportHands_FailedTitle")); throw new DHInternalException(new NonLocalizableString("Failed to export hands to 3rd party."), e); } }