public void InitializeNavigation() { try { SettingsView = new SettingsView(); SettingsViewModel = new SettingsViewModel(ApplicationModel); SettingsView.DataContext = SettingsViewModel; DownloadView = new DownloadView(); DownloadsViewModel = new DownloadsViewModel(ApplicationModel); DownloadView.DataContext = DownloadsViewModel; SpotifyView = new SpotifyView(); SpotifyViewModel = new SpotifyViewModel(ApplicationModel); SpotifyView.DataContext = SpotifyViewModel; YouTubeView = new YouTubeView(); YouTubeViewModel = new YouTubeViewModel(ApplicationModel); YouTubeView.DataContext = YouTubeViewModel; ContentWindow = SpotifyView; } catch (Exception ex) { new LogException(ex); } }
private void RenewDownloadView() { DownloadView = new DownloadView(); DownloadView.Closed += (sender, args) => { RenewDownloadView(); }; }
private Unit StartDownload(IWindow mwv) { var dlv = new DownloadView(); dlv.DataContext = new DownloadViewModel(); dlv.ShowDialog(mwv); return(Unit.Default); }
private void DownloadView_Clicked(object sender, RoutedEventArgs e) { Download.SetCurrentValue(BackgroundProperty, new SolidColorBrush(Colors.Blue)); Sounds.SetCurrentValue(BackgroundProperty, new SolidColorBrush(Colors.Transparent)); Game.SetCurrentValue(BackgroundProperty, new SolidColorBrush(Colors.Transparent)); DownloadView downloadView = new DownloadView(); frame.NavigationService.Navigate(downloadView); }
public MainWindow() { InitializeComponent(); frame.NavigationUIVisibility = NavigationUIVisibility.Hidden; DownloadView downloadView = new DownloadView(); frame.NavigationService.Navigate(downloadView); Download.SetCurrentValue(BackgroundProperty, new SolidColorBrush(Colors.Blue)); }
public void DownloadWorkbooksTest() { var url = new TableauServerUrls(ServerProtocol.Http, "10.107.0.240:8000", "ITCostSurvey", 10, ServerVersion.Server9); var signIn = new TableauServerSignIn( url, "public", "tableau1user%", new TaskStatusLogs()); signIn.ExecuteRequest(); var a = new DownloadWorkbooksList(url, signIn); a.ExecuteRequest(); Assert.AreEqual(2, a.Workbooks.Count); var b = new DownloadProjectsList(url, signIn); b.ExecuteRequest(); Assert.AreEqual(1, b.Projects.Count()); signIn = new TableauServerSignIn( new TableauServerUrls(ServerProtocol.Http, "10.107.0.240:8000", "ITCostSurvey", 10, ServerVersion.Server9), "tableauAdmin", "ta1user%", new TaskStatusLogs()); signIn.ExecuteRequest(); a = new DownloadWorkbooksList( new TableauServerUrls(ServerProtocol.Http, "10.107.0.240:8000", "ITCostSurvey", 10, ServerVersion.Server9), signIn); a.ExecuteRequest(); Assert.AreEqual(4, a.Workbooks.Count); foreach (var workbook in a.Workbooks) { var viewQuery = new DownloadViewsForWorkbookList(workbook.Id, url, signIn); viewQuery.ExecuteRequest(); Assert.AreEqual(1, viewQuery.Views.Count); foreach (var view in viewQuery.Views) { var thumbnailQuery = new DownloadView(url, signIn); var result = thumbnailQuery.GetPreviewImage(workbook.Id, view.Id); Assert.AreNotEqual(0, result.Length); } } b = new DownloadProjectsList(url, signIn); b.ExecuteRequest(); Assert.AreEqual(1, b.Projects.Count()); var siteViews = new DownloadViewsForSiteList(url, signIn); siteViews.ExecuteRequest(); Assert.AreEqual(0, siteViews.Views.Count); }
private void DownloadFile(Attachment attachment) { var dialog = new FolderBrowserDialog(); if (dialog.ShowDialog() == DialogResult.OK) { var dc = DownloadView.DataContext as DownloadViewModel; attachment.Path = dialog.SelectedPath; dc?.Files.Add(attachment); DownloadView.Show(); } }
public void InitializeNavigation() { SettingsView = new SettingsView(); SettingsViewModel = new SettingsViewModel(ApplicationModel); SettingsView.DataContext = SettingsViewModel; DownloadView = new DownloadView(); DownloadsViewModel = new DownloadsViewModel(ApplicationModel); DownloadView.DataContext = DownloadsViewModel; HomeView = new HomeView(); HomeViewModel = new HomeViewModel(ApplicationModel); HomeView.DataContext = HomeViewModel; ContentWindow = HomeView; }
private void GetSystem() { foreach (var s in CommunicationViewModel.OpenConnections.Where(s => s.ConnectMode == ConnectMode.Install).Select(n => n.UnitId) .Except(TabCollection.OfType <MainUnitViewModel>().Select(u => u.Id))) { AddMainUnit(s); } var nq = new DownloadView(); nq.Title = "Download to PC ESC => GUI"; nq.Background = System.Windows.Media.Brushes.LightGreen; var qq = new CommunicationReceive(this);// EscCommunicationBase(this); nq.DataContext = qq; nq.Show(); }
private void SendUnitData() { if (TabCollection.OfType <MainUnitViewModel>().All(model => model.ConnectType == ConnectType.None)) { MessageBox.Show(Main.MessageBoxUploadText, Main.MessageBoxUploadTitle, MessageBoxButton.OK, MessageBoxImage.Question); SwitchToCommunicationTab(); } else { var nq = new DownloadView { Title = "UPLOAD to ESC: GUI => ESC", Background = System.Windows.Media.Brushes.LightCoral }; var qq = new CommunicationSend(this);// EscCommunicationBase(this); nq.DataContext = qq; nq.Show(); } }
static async Task Main(string[] args) { if (args.Length > 0) { Settings = Settings.CreateOverride(args); } if (Settings.MigrateOldLibrarianData.Length > 0) { Migrate(); return; } if (Settings.Log) { Logger.SetLogger(new Logger("log.txt")); } AppDomain.CurrentDomain.UnhandledException += (sender, eventArgs) => Logger.Instance.Log(eventArgs.ExceptionObject.ToString() ?? "Unknown Exception", Logger.Level.Error); State = new State(Settings); using UiHub uiHub = UiHub.Register(80, 20, true); uiHub.Title = $"Librarian v{Version}"; uiHub.MainLoopInterval = Settings.UiInputInterval; uiHub.ViewUpdateReduction = Settings.UiRenderReduction; InitView initView = new InitView(uiHub.AddView("Init")); MainView mainView = new MainView(uiHub.AddView("Main")); DownloadView downloadView = new DownloadView(uiHub.AddView("Download")); ScanView scanView = new ScanView(uiHub.AddView("Scan")); State.PropertyChanged += (s, e) => { switch (e.PropertyName) { case nameof(State.Current): switch (State.Current) { case State.View.Init: uiHub.SwitchView(initView.Name); break; case State.View.Main: uiHub.SwitchView(mainView.Name); break; case State.View.Download: uiHub.SwitchView(downloadView.Name); break; case State.View.Scan: uiHub.SwitchView(scanView.Name); break; } break; case nameof(State.InitCurrentPath): initView.UpdateView(State.InitCurrentPath); break; default: mainView.UpdateView(State); break; } }; State.DownloadState.PropertyChanged += (s, e) => downloadView.UpdateView(State.DownloadState); State.ScanState.PropertyChanged += (s, e) => scanView.UpdateView(State.ScanState); downloadView.UpdateView(State.DownloadState); scanView.UpdateView(State.ScanState); CancellationTokenSource tokenSource = new CancellationTokenSource(); Logger.Instance.Log($"Starting Librarian v{Version}"); Task run = Task.Run(() => Run(tokenSource.Token), tokenSource.Token); uiHub.Run(); tokenSource.Cancel(); await run; Logger.Instance.Log("Stopping"); }
public void ViewPdfLinkTest() { var url = new TableauServerUrls(ServerProtocol.Http, "10.107.0.240:8000", "ITCostSurvey", 10, ServerVersion.Server9); var signIn = new TableauServerSignIn( url, "tableauAdmin", "ta1user%", new TaskStatusLogs()); signIn.ExecuteRequest(); var workbooks = new DownloadWorkbooksList( new TableauServerUrls(ServerProtocol.Http, "10.107.0.240:8000", "ITCostSurvey", 10, ServerVersion.Server9), signIn); workbooks.ExecuteRequest(); var workbook = workbooks.Workbooks.First(); var viewQuery = new DownloadViewsForWorkbookList(workbook.Id, url, signIn); viewQuery.ExecuteRequest(); var view = viewQuery.Views.First(); var a = new TrustedUrls(workbook.Name.Replace(" ", ""), view.Name.Replace(" ", ""), url, signIn); var exportPdfUrl = a.GetExportPdfUrl(); Assert.IsFalse(string.IsNullOrEmpty(exportPdfUrl)); var thumbnailUrl = a.GetPreviewImageUrl(); Assert.IsFalse(string.IsNullOrEmpty(thumbnailUrl)); var viewUrl = a.GetTrustedViewUrl(); Assert.IsFalse(string.IsNullOrEmpty(viewUrl)); var client = new WebClient(); var data = client.DownloadData(exportPdfUrl); Assert.IsNotNull(data); Assert.IsTrue(data.Any()); data = null; var downloadView = new DownloadView(url, signIn); data = downloadView.GetPreviewImage(workbook.Id, view.Id); Assert.IsNotNull(data); Assert.IsTrue(data.Any()); a.AddViewParameter("Gabba", "1"); a.AddViewParameter("Hey", "2"); exportPdfUrl = a.GetExportPdfUrl(); Assert.IsTrue(exportPdfUrl.Contains("?")); Assert.IsTrue(exportPdfUrl.EndsWith("Gabba=1&Hey=2")); thumbnailUrl = a.GetPreviewImageUrl(); Assert.IsTrue(thumbnailUrl.Contains("?")); Assert.IsTrue(thumbnailUrl.EndsWith("Gabba=1&Hey=2")); a.HideToolbar = true; viewUrl = a.GetTrustedViewUrl(); Assert.IsTrue(viewUrl.EndsWith("&:toolbar=no")); a.HideToolbar = null; viewUrl = a.GetTrustedViewUrl(); Assert.IsFalse(viewUrl.EndsWith("&:toolbar=no")); a.HideToolbar = false; viewUrl = a.GetTrustedViewUrl(); Assert.IsFalse(viewUrl.EndsWith("&:toolbar=no")); a.HideTabs = true; viewUrl = a.GetTrustedViewUrl(); Assert.IsTrue(viewUrl.EndsWith("&:tabs=no")); a.HideTabs = null; viewUrl = a.GetTrustedViewUrl(); Assert.IsFalse(viewUrl.EndsWith("&:tabs=no")); a.HideTabs = false; viewUrl = a.GetTrustedViewUrl(); Assert.IsFalse(viewUrl.EndsWith("&:tabs=no")); a = new TrustedUrls(workbook.Name.Replace(" ", ""), view.Name.Replace(" ", ""), url, signIn); a.HideToolbar = true; viewUrl = a.GetTrustedViewUrl(); Assert.IsTrue(viewUrl.EndsWith("?:toolbar=no")); a.HideToolbar = null; viewUrl = a.GetTrustedViewUrl(); Assert.IsFalse(viewUrl.EndsWith("?:toolbar=no")); a.HideToolbar = false; viewUrl = a.GetTrustedViewUrl(); Assert.IsFalse(viewUrl.EndsWith("?:toolbar=no")); a.HideTabs = true; viewUrl = a.GetTrustedViewUrl(); Assert.IsTrue(viewUrl.EndsWith("?:tabs=no")); a.HideTabs = null; viewUrl = a.GetTrustedViewUrl(); Assert.IsFalse(viewUrl.EndsWith("?:tabs=no")); a.HideTabs = false; viewUrl = a.GetTrustedViewUrl(); Assert.IsFalse(viewUrl.EndsWith("?:tabs=no")); a.HideToolbar = true; a.HideTabs = true; viewUrl = a.GetTrustedViewUrl(); Assert.IsTrue(viewUrl.EndsWith("?:tabs=no&:toolbar=no")); }