Ejemplo n.º 1
0
        public Form1()
        {
            InitializeComponent();

            // set output path for image
            currentDirectory                = Directory.GetCurrentDirectory();
            outputPathForFinalImage         = Directory.GetCurrentDirectory();
            outputPathForConfigXML          = Directory.GetCurrentDirectory();
            outputFullFilePathForConfigXML  = outputPathForConfigXML + "\\" + CONFIG_XML_FILE_NAME;
            outputFullFilePathForFinalImage = outputPathForFinalImage + "\\" + WALLPAPER_IMAGE_FILE_NAME;
            // get temp dir
            //System.IO.Path.GetTempPath();


            // Determin Timer and Begin with it.
            if (File.Exists(outputFullFilePathForConfigXML) && isAutoRefreshEnabled)
            {
                XmlDocument ConfigXMLDoc = new XmlDocument();
                ConfigXMLDoc.Load(outputFullFilePathForConfigXML);

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

                timerInterval = oConfig.TimerIntervalSeconds * 1000;

                // Timer
                if (oConfig.TimerEnabled)
                {
                    StartAutoRefreshTimerDuringAppUsage();

                    wasAutoRefreshTimerStartedAtApplicationStart = true;
                }
            }
        }
Ejemplo n.º 2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            // Set default colors
            btnForegroundColor.BackColor = Color.Black;
            btnBackgroundColor.BackColor = Color.White;
            colorDialogBackground.Color  = Color.White;
            colorDialogForeground.Color  = Color.Black;

            // Set URL links
            LinkLabel.Link link1 = new LinkLabel.Link();
            link1.LinkData      = "www.fyghtsoft.com";
            llblFyghtSoft1.Text = "FyghtSoft Website";
            llblFyghtSoft1.Links.Add(link1);

            LinkLabel.Link link2 = new LinkLabel.Link();
            link2.LinkData    = "www.fyghtsoft.com/index.php/resources";
            llblSupportA.Text = "Resources and Training";
            llblSupportA.Links.Add(link2);

            LinkLabel.Link link3 = new LinkLabel.Link();
            link3.LinkData    = "www.fyghtsoft.com/forums/";
            llblSupportB.Text = "Community Support Forums";
            llblSupportB.Links.Add(link3);


            // Set default image paths
            tbxImageOutputPath.Text = outputPathForFinalImage;
            lblOutputImagePath.Text = outputPathForFinalImage;

            // Set Dimension Layout Info
            CurrentDesktopDimensions oCDD =
                WallpaperManager.GetDesktopDimensions();

            lblDesktopDimensions.Text = oCDD.DesktopWidth.ToString() + " x "
                                        + oCDD.DesktopHeight.ToString() + " (pixels)";

            // Default URLs
            lblDefaultWSHDataIntegrationURL.Text = oInfaWSHMetaData.strDefaultURL_DataIntegration;
            lblDefaultWSHMetaDataURL.Text        = oInfaWSHMetaData.strDefaultURL_MetaData;

            // set dropdown defaults
            ddWallpaperPosition.SelectedIndex = 0;
            ddFontSize.SelectedIndex          = 6;



            if (File.Exists(outputFullFilePathForConfigXML))
            {
                //MessageBox.Show("Configuration File Exists!");

                XmlDocument ConfigXMLDoc = new XmlDocument();
                ConfigXMLDoc.Load(outputFullFilePathForConfigXML);

                InfaBGInfo.Config.ConfigXML oConfig = new InfaBGInfo.Config.ConfigXML(ConfigXMLDoc);
                PopulateFormWithConfigXMLValues(oConfig);
            }
            //else
            //MessageBox.Show("Configuration File Does Not Exist");
        }
Ejemplo n.º 3
0
        private void saveForm()
        {
            // Determine Current Directory
            //string tmpCurrentDir = Directory.GetCurrentDirectory();

            // Determine Radio Buttons Checked
            // Custom Bkg option
            int tmpCustomBkgOption = rbtnBackgrounCustomOptionA.Checked ? 0 : 1;

            // Desktop Section placement


            // Verify that settings are established
            if (!verifyInput_Settings_Tab())
            {
                MessageBox.Show("Input Error!\nAll fields on the settings tab form must have valid values!");
            }
            else
            {
                try
                {
                    InfaBGInfo.Config.ConfigXML oConfig = new InfaBGInfo.Config.ConfigXML(tbxWSHServerName.Text
                                                                                          , int.Parse(tbxWSHServerPort.Value.ToString()), cbxUsesSSL.Checked
                                                                                          , tbxDomainName.Text, tbxRepName.Text
                                                                                          , tbxRepUserName.Text, tbxRepPassword.Text
                                                                                          , tmpCustomBkgOption, colorDialogBackground.Color
                                                                                          , ddWallpaperPosition.SelectedIndex
                                                                                          , @tbxOutputExistingImage.Text, colorDialogForeground.Color
                                                                                          , int.Parse(ddFontSize.SelectedItem.ToString()), 0
                                                                                          , cbxShowAvailableWSHReps.Checked, cbxShowAllRepFolders.Checked, cbxShowGlobalRepWorkflows.Checked
                                                                                          , cbxShowAssociatedIntSvc.Checked, cbxShowSystemInfoBlock.Checked
                                                                                          , cbxTimerEnabled.Checked, int.Parse(tbxRefreshRate.Value.ToString()))
                    ;

                    oConfig.outputXMLToFile(@currentDirectory + "\\" + CONFIG_XML_FILE_NAME);

                    isOkayToSetWallpaper = true;

                    // This must be reset in case the timer was enable, the form was opened and the
                    // checkbox to disable the refresh was selected and OK/Apply are clicked.
                    isAutoRefreshEnabled = cbxTimerEnabled.Checked;

                    if (isAutoRefreshEnabled)
                    {
                        timerInterval = int.Parse(tbxRefreshRate.Value.ToString()) * 1000;
                        StartAutoRefreshTimerDuringAppUsage();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message.ToString());
                }
            }
        }
Ejemplo n.º 4
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);
        }