Example #1
0
 private static void CSCblog(eid_vwr_loglevel logLevel, [MarshalAs(UnmanagedType.LPWStr)] string str)
 {
     if (logLevel >= theData.log_level)
     {
         theData.logText += "CSCblogtest called " + str + "\n";
     }
 }
Example #2
0
 private static void CSCblog(eid_vwr_loglevel logLevel, [MarshalAs(UnmanagedType.LPWStr)] string str)
 {
     //Console.WriteLine("CSCblog called: ");
     //Console.WriteLine(str);
     if (logLevel >= theData.log_level)
     {
         theData.logText += "CSCblogtest called " + str + "\n";
     }
 }
Example #3
0
 private static void CSCblog(eid_vwr_loglevel logLevel, [MarshalAs(UnmanagedType.LPWStr)] string str)
 {
     theData.WriteLog("CSCblogtest called " + str + "\n", logLevel);
 }
Example #4
0
        void Perform_Version_Check(bool showMessages)
        {
            try
            {
                Popup myPopup = new Popup();
                myPopup.IsOpen = true;
                //do not log explicit when no messages should be shown to user (i.e. during auto version check)
                eid_vwr_loglevel errorLevel = eid_vwr_loglevel.EID_VWR_LOG_NORMAL;

                string url          = "";
                string releaseNotes = "";

                if (showMessages)
                {
                    errorLevel = eid_vwr_loglevel.EID_VWR_LOG_ERROR;
                }

                theBackendData.WriteLog("starting the online version check..\n", eid_vwr_loglevel.EID_VWR_LOG_NORMAL);

                string language = CultureInfo.CurrentUICulture.TwoLetterISOLanguageName.ToString();

                if (!Version.getUpdateUrl(out bool updateNeeded, language, ref url, ref releaseNotes))
                {
                    //no updated version found, report this in the log
                    theBackendData.WriteLog("failed to check for online update\n", errorLevel);
                    ShowErrorMessage(showMessages);
                    return;
                }

                if (updateNeeded)
                {
                    if (url == "")
                    {
                        theBackendData.WriteLog("A newer version of the eID Viewer has been found, but not the url to download it\n", eid_vwr_loglevel.EID_VWR_LOG_COARSE);
                        theBackendData.WriteLog("Newer version should be available at https://eid.belgium.be\n", eid_vwr_loglevel.EID_VWR_LOG_COARSE);
                        ShowErrorMessage(showMessages);
                        return;
                    }
                    //for safety, we do not accept all urls
                    else if (url.StartsWith("https://eid.belgium.be"))
                    {
                        //xml Version check
                        string aboutMessage = "\n" + eIDViewer.Resources.ApplicationStringResources.newVersionDownload;
                        string caption      = eIDViewer.Resources.ApplicationStringResources.newVersionDownloadTitle;

                        MessageBoxResult result = MessageBox.Show(aboutMessage, caption, MessageBoxButton.OKCancel, MessageBoxImage.Information, MessageBoxResult.Cancel);
                        if (result == MessageBoxResult.OK)
                        {
                            try
                            {
                                System.Diagnostics.Process.Start(url);
                            }
                            catch (Exception ex)
                            {
                                theBackendData.WriteLog("Error: Could not start a browser to visit" + url + ex.Message, eid_vwr_loglevel.EID_VWR_LOG_COARSE);
                            }
                        }
                    }
                    else
                    {
                        theBackendData.WriteLog("The url to download the new version did not start with https://eid.belgium.be\n", eid_vwr_loglevel.EID_VWR_LOG_COARSE);
                        ShowErrorMessage(showMessages);
                        return;
                    }
                }
                else
                {
                    theBackendData.WriteLog("No viewer update is needed\n", eid_vwr_loglevel.EID_VWR_LOG_NORMAL);
                    if (showMessages)
                    {
                        MessageBox.Show(eIDViewer.Resources.ApplicationStringResources.VersionUpToDate, eIDViewer.Resources.ApplicationStringResources.VersionUpToDateTitle, MessageBoxButton.OK, MessageBoxImage.Information);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error occured during eID Viewer version check" + ex.Message);
            }
        }