Ejemplo n.º 1
0
        public async void LoadWorkspaces()
        {
            LoadingActivityStarted(true);

            try
            {
                ClearUX();

                Workspaces = new ObservableCollection <Workspace>(
                    await PBIEClient.GetWorkspaces());
                if (Workspaces.Count > 0)
                {
                    IsWorkspaceResultVisible = false;
                }
                else
                {
                    IsWorkspaceResultVisible = true;
                    WorkspaceResult          = String.Format("There are no workspaces in your '{0}' workspace collection", WorkspaceCollectionName);
                }
            }
            catch (Exception ex)
            {
                IsWorkspaceResultVisible = true;
                WorkspaceResult          = ex.ToString();
            }
            LoadingActivityStarted(false);
        }
Ejemplo n.º 2
0
        public void LoadCredentials()
        {
            LoadingActivityStarted(true);
            try
            {
                localSettings           = ApplicationData.Current.LocalSettings;
                Key                     = localSettings.Values["PBIEKey"].ToString();
                WorkspaceCollectionName = localSettings.Values["WorkspaceCollectionName"].ToString();
                PBIEClient.InitializePBIEClient(Key, WorkspaceCollectionName);

                ClearUX();
            }
            catch (Exception)
            {
                DisplayMessage("No credentials", "Please enter valid Access Key and Workspace Collection Name values");
            }
            LoadingActivityStarted(false);
        }
Ejemplo n.º 3
0
        public async void CreateWorkspace()
        {
            CreateWorkspacePopUpIsOpen = false;
            ActivityStatus             = String.Format("Your Workspace {0} is being created...", WorkspaceNameToCreate);
            LoadingActivityStarted(true);

            var createdWorkspace = await PBIEClient.CreateWorkspace(WorkspaceNameToCreate);

            if (createdWorkspace != null)
            {
                ActivityStatus = "Your workspace has been created";
                Workspaces.Add(createdWorkspace);
                IsWorkspaceResultVisible = false;
            }

            else
            {
                DisplayMessage("Create new Workspace", "Something went wrong, please try again");
            }
            LoadingActivityStarted(false);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 'Cheat' code to Display a selected Report.
        /// It breaks the MVVM Model as it creates a PopUpContent that will be displayed in the View.
        /// This is done because the WebView's Source can not bind a NavigationString straight forward
        /// </summary>
        private async void LoadReport()
        {
            MainScreenOpacity = 0.5;
            IsReportPopUpOpen = true;
            Html = await PBIEClient.LoadReport(SelectedReport, SelectedImport.Datasets[0].Id);

            ReportStackPanel = new StackPanel()
            {
                Height = 600,
                Width  = 700
            };

            WebView wv = new WebView()
            {
                Margin = new Thickness(10),
                Height = 480,
                Width  = 640,
                HorizontalAlignment = HorizontalAlignment.Center
            };

            wv.NavigateToString(Html);

            Button bt = new Button()
            {
                Content = "Close window",
                Height  = 40
            };

            bt.Click += (sender, eventArgs) =>
            {
                IsReportPopUpOpen = false;
                MainScreenOpacity = 1;
            };

            bt.HorizontalAlignment = HorizontalAlignment.Center;
            bt.Margin = new Thickness(10);

            ReportStackPanel.Children.Add(wv);
            ReportStackPanel.Children.Add(bt);
        }
Ejemplo n.º 5
0
 public async void LoadImports()
 {
     LoadingActivityStarted(true);
     try
     {
         Imports = new ObservableCollection <Import>(
             await PBIEClient.GetImports());
         if (Imports.Count > 0)
         {
             IsImportResultVisible = false;
         }
         else
         {
             IsImportResultVisible = true;
             ImportResult          = String.Format("There are no reports in {0} workspace", SelectedWorkspace.DisplayName);
         }
     }
     catch (Exception ex)
     {
         IsImportResultVisible = true;
         ImportResult          = ex.ToString();
     }
     LoadingActivityStarted(false);
 }
Ejemplo n.º 6
0
        public async void AddImport()
        {
            AddImportPopUpIsOpen = false;
            ActivityStatus       = "Your report is being uploaded...";
            LoadingActivityStarted(true);

            var createdImport = await PBIEClient.UploadImport(DataSetNameToCreate, StreamFromSelectedFile);

            StreamFromSelectedFile.Dispose();
            SelectedFile = String.Empty;

            if (createdImport != null)
            {
                ActivityStatus = "Your report has been uploaded";
                Imports.Add(createdImport);
                IsImportResultVisible = false;
            }
            else
            {
                DisplayMessage("Unknown error", "Something went wrong, please try again");
            }

            LoadingActivityStarted(false);
        }