示例#1
0
        public OnlineAddView()
        {
            InitializeComponent();

            Task.Run(() =>
            {
                sharePointInformation = ApplicationState.GetValue <SharePointInformation>("SharePointInformation");
                if (sharePointInformation != null && !string.IsNullOrEmpty(sharePointInformation?.Username))
                {
                    password     = PortableCryptography.Decrypt(sharePointInformation.EncryptedPassword, sharePointInformation.Username);
                    username     = sharePointInformation.Username;
                    siteUrl      = sharePointInformation.SiteUrl;
                    isOnlineSite = sharePointInformation.IsSharePointOnline;

                    // create SharePoint Client
                    sharePointDataService = new SharePointDataService(username, password, siteUrl, isOnlineSite);
                    var listCollection    = sharePointDataService.GetAllLists() as ListCollection;

                    Dispatcher.Invoke(() =>
                    {
                        dtSharePointLists.ItemsSource = listCollection;

                        grdLoadingOverlay.Visibility = Visibility.Hidden;
                    });
                }
                else
                {
                    Dispatcher.Invoke(() =>
                    {
                        // For now, if we get to this screen without credentials, just push backwards.
                        btnBackNav_Click(this, null);
                    });
                }
            });
        }
示例#2
0
        private void btnRefresh_Click(object sender, RoutedEventArgs e)
        {
            grdLoadingOverlay.Visibility = Visibility.Visible;

            Task.Run(() =>
            {
                if (sharePointInformation != null && !string.IsNullOrEmpty(sharePointInformation?.Username))
                {
                    password     = PortableCryptography.Decrypt(sharePointInformation.EncryptedPassword, sharePointInformation.Username);
                    username     = sharePointInformation.Username;
                    siteUrl      = sharePointInformation.SiteUrl;
                    isOnlineSite = sharePointInformation.IsSharePointOnline;

                    // create SharePoint Client
                    sharePointDataService = new SharePointDataService(username, password, siteUrl, isOnlineSite);
                    var listCollection    = sharePointDataService.GetAllLists() as ListCollection;

                    Dispatcher.Invoke(() =>
                    {
                        dtSharePointLists.ItemsSource = listCollection;
                        grdLoadingOverlay.Visibility  = Visibility.Hidden;
                    });
                }
            });
        }
示例#3
0
        private void SubmitToSharePoint(DataGrid dataGrid)
        {
            if (SharePointDataService != null)
            {
                var selectedLists = new List <SharePointListStructure>();
                for (int i = 0; i < dataGrid.SelectedItems.Count; i++)
                {
                    selectedLists.Add((SharePointListStructure)dataGrid.SelectedItems[i]);
                }

                var includesOnlineLists = selectedLists.Any(x => !x.LocalList);
                var localLists          = selectedLists.FindAll(x => x.LocalList);

                if (includesOnlineLists)
                {
                    RootWindow.MessageQueue.Enqueue("Ignoring Online Lists.");
                }

                // pass through our lists to create in SharePoint.
                SharePointDataService.CreateLists(localLists);
            }
            else
            {
                RootWindow.MessageQueue.Enqueue("No SharePoint Site Set.");
            }
        }
        public void Uninstall()
        {
            // Uninstall SQL tables and stored procedures
            SharePointDataService.UnInstall();
            RemoveWidgets(this);

            var assembly     = GetType().Assembly;
            var assemblyName = assembly.GetName().Name;
            var resources    = AssemblyResources(assembly).ToList();

            RemovePages(assemblyName, resources);
            RemoveCss(assemblyName, resources);
            RemoveSupplementaryFiles(assemblyName, resources);
            RemoveJavaScriptFiles(assemblyName, resources);
        }
        public void Install(Version lastInstalledVersion)
        {
            if (Version > lastInstalledVersion)
            {
                // Install SQL tables and stored procedures
                SharePointDataService.Install();

                var assembly     = GetType().Assembly;
                var assemblyName = assembly.GetName().Name;
                var resources    = AssemblyResources(assembly).ToList();
                InstallWidgets(assemblyName, resources);
                InstallPages(assemblyName, resources);
                InstallCss(assemblyName, resources);
                InstallSupplementaryFiles(assemblyName, resources);
                InstallJavaScriptFiles(assemblyName, resources);

                // Clear Cache for Theme Configuration
                foreach (var theme in Themes.List(ThemeTypes.Site))
                {
                    Evolution.Components.ThemeConfigurationDatas.Expire(theme.Type);
                }
            }
        }
示例#6
0
        private void SetUpSharePointDataService(bool synchronous)
        {
            if (!synchronous)
            {
                Task.Run(() =>
                {
                    var sharePointInformation = ApplicationState.GetValue <SharePointInformation>("SharePointInformation");
                    if (sharePointInformation != null && !string.IsNullOrEmpty(sharePointInformation?.Username))
                    {
                        var password     = PortableCryptography.Decrypt(sharePointInformation.EncryptedPassword, sharePointInformation.Username);
                        var username     = sharePointInformation.Username;
                        var siteUrl      = sharePointInformation.SiteUrl;
                        var isOnlineSite = sharePointInformation.IsSharePointOnline;

                        // create SharePoint Client
                        try
                        {
                            SharePointDataService = new SharePointDataService(username, password, siteUrl, isOnlineSite);
                        }
                        catch (Exception ex)
                        {
                            //IdcrlException: The sign-in name or password does not match one in the Microsoft account system.
                            var innerEx = ex.InnerException?.Message;
                            if (!string.IsNullOrEmpty(innerEx))
                            {
                                RootWindow.MessageQueue.Enqueue("Failed attempting to connect to SharePoint isntance: " + innerEx);
                            }
                        }

                        Dispatcher.Invoke(() =>
                        {
                            // make a note of our failed lists.
                            miLeftSubmitToSharePoint.IsEnabled  = true;
                            miRightSubmitToSharePoint.IsEnabled = true;
                        });
                    }
                    else
                    {
                        Dispatcher.Invoke(() =>
                        {
                            // make a note of our failed lists.
                            miLeftSubmitToSharePoint.IsEnabled  = false;
                            miRightSubmitToSharePoint.IsEnabled = false;
                        });
                    }
                });
            }
            else
            {
                var sharePointInformation = ApplicationState.GetValue <SharePointInformation>("SharePointInformation");
                if (sharePointInformation != null && !string.IsNullOrEmpty(sharePointInformation?.Username))
                {
                    var password     = PortableCryptography.Decrypt(sharePointInformation.EncryptedPassword, sharePointInformation.Username);
                    var username     = sharePointInformation.Username;
                    var siteUrl      = sharePointInformation.SiteUrl;
                    var isOnlineSite = sharePointInformation.IsSharePointOnline;

                    // create SharePoint Client
                    try
                    {
                        SharePointDataService = new SharePointDataService(username, password, siteUrl, isOnlineSite);
                    }
                    catch (Exception ex)
                    {
                        //IdcrlException: The sign-in name or password does not match one in the Microsoft account system.
                        var innerEx = ex.InnerException?.Message;
                        if (!string.IsNullOrEmpty(innerEx))
                        {
                            RootWindow.MessageQueue.Enqueue("Failed attempting to connect to SharePoint isntance: " + innerEx);
                        }
                    }

                    // make a note of our failed lists.
                    miLeftSubmitToSharePoint.IsEnabled  = true;
                    miRightSubmitToSharePoint.IsEnabled = true;
                }
                else
                {
                    // make a note of our failed lists.
                    miLeftSubmitToSharePoint.IsEnabled  = false;
                    miRightSubmitToSharePoint.IsEnabled = false;
                }
            }
        }