Example #1
0
        private bool swapDesktopWallpaper()
        {
            //
            StringBuilder sb = new StringBuilder();

            //
            textToImage oTextToImage = new textToImage();

            try
            {
                // Attempt to connect to WSH
                InfaWSHMetaDataInfo oGo = null;
                try
                {
                    oGo = new InfaWSHMetaDataInfo(tbxWSHServerName.Text, (int)tbxWSHServerPort.Value
                                                  , "", tbxDomainName.Text, tbxRepName.Text, tbxRepUserName.Text, tbxRepPassword.Text
                                                  , tbxDomainName.Text, "");
                }
                catch (Exception ex)
                {
                    isInfaWSHServerHavingIssue = true;

                    MessageBox.Show("InfaBGInfo Process Failure or Server Connectivity Issue:\n"
                                    + ex.Message.ToString()
                                    + "\n\n"
                                    + "Please correct the issue with the Informatica Server."
                                    + "\n\n"
                                    + "You may need to close and re-open the application in order to attempt to re-connect."
                                    );

                    return(false);
                }

                // provide options as a struct and passed to wallpaper settings
                ShowOutputInfoOptions oBkgOptions = new ShowOutputInfoOptions();
                oBkgOptions.showWSHRepositoriesAvailable     = cbxShowAvailableWSHReps.Checked;
                oBkgOptions.showAllRepositoryFolders         = cbxShowAllRepFolders.Checked;
                oBkgOptions.showGlobalRepositoryWorkflowInfo = cbxShowGlobalRepWorkflows.Checked;
                oBkgOptions.showRepositoryAssociatedIntSvc   = cbxShowAssociatedIntSvc.Checked;
                oBkgOptions.showOSInformation = cbxShowSystemInfoBlock.Checked;

                //...testing...
                //sb.AppendLine("Last Refresh: " + DateTime.Now.ToLongTimeString());

                // Add compiles values to the output
                sb.Append(oGo.GatherStringDataValues(oBkgOptions).ToString());

                if (oBkgOptions.showOSInformation)
                {
                    WindowsSystemInfo oWSI = new WindowsSystemInfo();
                    sb.Append(oWSI.GetSystemInfoString());
                }

                string tmpOutput = sb.ToString();

                // Build Image with Critical Text Values
                oTextToImage.SaveImageToFile(tmpOutput
                                             , colorDialogBackground.Color, colorDialogForeground.Color
                                             , int.Parse(ddFontSize.SelectedItem.ToString())
                                             , FontStyle.Regular
                                             , outputFullFilePathForFinalImage
                                             , WallpaperManager.GetDesktopDimensions()
                                             , tbxOutputExistingImage.Text);
                oTextToImage = null;

                tmpOutput = "";
                sb.Length = 0;

                //Main Task to Swap wallpaper
                WallpaperManager.SetWallpaper(outputFullFilePathForFinalImage
                                              , (Wallpaper.Style)ddWallpaperPosition.SelectedIndex);


                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Process Failure:\n" + ex.Message.ToString());
                return(false);
            }
        }
Example #2
0
        public StringBuilder GatherStringDataValues(ShowOutputInfoOptions okDisplay)
        {
            // holds count of invalid workflows when assessing workflows in a single folder
            int    invalidWorkflowsInFolder = 0;
            string tmpOutputHeader          = "Informatica Repository Information - " + REPO_NAME.ToUpper();

            StringBuilder InfaStringRecordsValues = new StringBuilder();

            // Provide some type of header
            InfaStringRecordsValues.AppendLine(tmpOutputHeader);
            InfaStringRecordsValues.AppendLine("".PadRight(tmpOutputHeader.Length, '#'));
            InfaStringRecordsValues.AppendLine("");


            // List all repositories available to hit from WSH
            if (okDisplay.showWSHRepositoriesAvailable)
            {
                InfaStringRecordsValues.AppendLine("WSH Assigned Repositories:");
                foreach (string s in GetAllRepositoriesAvailableInWSH())
                {
                    InfaStringRecordsValues.AppendLine("\t" + s);
                }
                InfaStringRecordsValues.AppendLine("");
            }

            if (okDisplay.showAllRepositoryFolders)
            {
                InfaStringRecordsValues.AppendLine("Repository Folders:");
                foreach (string s in GetAllFoldersInRepository())
                {
                    int tmpNumWorkflowsInFolder = GetNumberOfWorkflowsInFolder(s, out invalidWorkflowsInFolder);

                    InfaStringRecordsValues.AppendLine("\t" + s
                                                       + " (Workflows: " + tmpNumWorkflowsInFolder.ToString() + ")");

                    numOfGlobalWorkflows += tmpNumWorkflowsInFolder;

                    if (invalidWorkflowsInFolder > 0)
                    {
                        numOfGlobalInvalidWorkflows++;
                    }

                    // reset value
                    invalidWorkflowsInFolder = 0;
                }
                InfaStringRecordsValues.AppendLine("");
            }


            if (okDisplay.showGlobalRepositoryWorkflowInfo)
            {
                // get total valid, invalid, and global count of workflows for the repository
                numOfGlobalValidWorkflows = numOfGlobalWorkflows - numOfGlobalInvalidWorkflows;
                InfaStringRecordsValues.AppendLine("Repository Workflows:");
                InfaStringRecordsValues.AppendLine("\tTotal Valid: ".PadRight(16, ' ') + numOfGlobalValidWorkflows);
                InfaStringRecordsValues.AppendLine("\tTotal Invalid: ".PadRight(16, ' ') + numOfGlobalInvalidWorkflows);
                InfaStringRecordsValues.AppendLine("");
            }


            if (okDisplay.showRepositoryAssociatedIntSvc)
            {
                InfaStringRecordsValues.AppendLine("Associated Integration Services: ");
                foreach (string s in GetAllIntegrationServicesPerRepository())
                {
                    InfaStringRecordsValues.AppendLine("\t" + s
                                                       + (GetIntegrationServicePingResult(s) ? " (Enabled)" : " (Disabled)"));
                }
                InfaStringRecordsValues.AppendLine("");
            }

            return(InfaStringRecordsValues);
        }
Example #3
0
        private bool RefreshWallpaperOnTimer()
        {
            if (File.Exists(outputFullFilePathForConfigXML) && isAutoRefreshEnabled)
            {
                XmlDocument ConfigXMLDoc = new XmlDocument();
                ConfigXMLDoc.Load(outputFullFilePathForConfigXML);

                InfaBGInfo.Config.ConfigXML oConfig = new InfaBGInfo.Config.ConfigXML(ConfigXMLDoc);


                //
                StringBuilder sb = new StringBuilder();

                //
                textToImage oTextToImage = new textToImage();

                try
                {
                    InfaWSHMetaDataInfo oGo = null;

                    try
                    {
                        // Attempt to connect to WSH
                        if (!isInfaWSHServerHavingIssue)
                        {
                            oGo = new InfaWSHMetaDataInfo(oConfig.WSHServerName, (int)oConfig.WSHServerPort
                                                          , "", oConfig.DomainName, oConfig.RepositoryName, oConfig.RepositoryUsername, oConfig.RepositoryPassword
                                                          , oConfig.DomainName, "");
                        }
                    }
                    catch (Exception ex)
                    {
                        isInfaWSHServerHavingIssue = true;

                        MessageBox.Show("InfaBGInfo Process Failure or Server Connectivity Issue:\n"
                                        + ex.Message.ToString()
                                        + "\n\n"
                                        + "Please correct the issue with the Informatica Server."
                                        + "\n\n"
                                        + "You must close and re-open the application in order to attempt to re-connect."
                                        + "\n\n"
                                        + "Timer Enabled: True"
                                        );

                        return(false);
                    }


                    // provide options as a struct and passed to wallpaper settings
                    ShowOutputInfoOptions oBkgOptions = new ShowOutputInfoOptions();
                    oBkgOptions.showWSHRepositoriesAvailable     = oConfig.ShowAvailableWSHRepositories;
                    oBkgOptions.showAllRepositoryFolders         = oConfig.ShowAllRepositoryFolders;
                    oBkgOptions.showGlobalRepositoryWorkflowInfo = oConfig.ShowGlobalRepositoryWorkflows;
                    oBkgOptions.showRepositoryAssociatedIntSvc   = oConfig.ShowAssociatedIntegrationServices;
                    oBkgOptions.showOSInformation = oConfig.ShowSystemInformationBlock;

                    //...testing..
                    sb.AppendLine("Last Refresh: " + DateTime.Now.ToLongTimeString());

                    // Add compiles values to the output
                    sb.Append(oGo.GatherStringDataValues(oBkgOptions).ToString());

                    if (oBkgOptions.showOSInformation)
                    {
                        WindowsSystemInfo oWSI = new WindowsSystemInfo();
                        sb.Append(oWSI.GetSystemInfoString());
                    }

                    string tmpOutput = sb.ToString();

                    // Build Image with Critical Text Values
                    oTextToImage.SaveImageToFile(tmpOutput
                                                 , oConfig.BkgColor, oConfig.ForegroundColor
                                                 , oConfig.FontSize
                                                 , FontStyle.Regular
                                                 , outputFullFilePathForFinalImage
                                                 , WallpaperManager.GetDesktopDimensions()
                                                 , oConfig.LayerOnImage);
                    oTextToImage = null;

                    tmpOutput = "";
                    sb.Length = 0;

                    //Main Task to Swap wallpaper
                    WallpaperManager.SetWallpaper(outputFullFilePathForFinalImage
                                                  , (Wallpaper.Style)oConfig.BkgPosition);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Process Failure (Refresh Enabled):\n" + ex.Message.ToString());
                }
            }
            else
            {
                return(false);
            }


            return(true);
        }