예제 #1
0
        public DlgEula()
        {
            InitializeComponent();

            TextReader reader = null;

            string fileName = "LicenseBSD.txt";

            string filePath = Project.GetMiscPath(fileName);

            try
            {
                if(File.Exists(fileName)
                    && File.GetLastWriteTime(fileName).AddDays(Project.LICENSE_FILE_MAX_AGE_DAYS).CompareTo(DateTime.Now) > 0)
                {
                    reader = new StreamReader(fileName);
                }
                else
                {
                    // load the file remotely, don't hold diagnostics if load fails:
                    string url = Project.MISC_FOLDER_URL + "/" + fileName;
                    DloadProgressForm loaderForm = new DloadProgressForm(url, fileName, false, true);
                    loaderForm.ShowDialog();
                    reader = new StreamReader(fileName);
                }
            }
            catch {}

            if(reader == null)
            {
                reader = new StringReader(eulaText);	// in case everything else fails
            }

            string strEula;
            while((strEula=reader.ReadLine()) != null)
            {
                eulaListBox.Items.Add(strEula);
            }
            Project.setDlgIcon(this);
        }
예제 #2
0
 private void loadMarkImages()
 {
     if(!m_triedLoad)
     {
         m_triedLoad = true;
         // try loading image files:
         string starFilePath = Project.GetMiscPath("redstar.gif");
         try
         {
             if(!File.Exists(starFilePath))
             {
                 // load the file remotely, don't hold diagnostics if load fails:
                 string url = Project.MISC_FOLDER_URL + "/redstar.gif";
                 DloadProgressForm loaderForm = new DloadProgressForm(url, starFilePath, false, true);
                 loaderForm.ShowDialog();
             }
             m_imageStar = new Bitmap(starFilePath);
         }
         catch {}
     }
 }
예제 #3
0
        //private static Hashtable bitmaps = new Hashtable();		// bitmap by name
        public static Bitmap getVehicleImage(string sym)
        {
            if(sym == null || sym.Length == 0 || "none".Equals(sym))
            {
                return null;
            }

            Bitmap ret = (Bitmap)bitmaps[sym];

            if(ret != null)
            {
                return ret;
            }

            try
            {
                string filePath = Project.GetVehPath(sym + ".gif");
                if(!File.Exists(filePath) && (tried[sym] == null || !(bool)tried[sym]))
                {
                    tried[sym] = true;
                    // load the file remotely, don't hold diagnostics if load fails:
                    string url = Project.MISC_FOLDER_URL + "/vehicles/" + sym + ".gif";
                    DloadProgressForm loaderForm = new DloadProgressForm(url, filePath, false, true);
                    loaderForm.ShowDialog();
                }

                if(File.Exists(filePath))
                {
                    ret = new Bitmap(filePath);
                    bitmaps[sym] = ret;
                }
            }
            catch
            {
                return null;
            }

            return ret;
        }
예제 #4
0
        public AboutForm()
        {
            InitializeComponent();

            this.Text = "About " + Project.PROGRAM_NAME_HUMAN;
            versionLabel.Text = Project.PROGRAM_NAME_HUMAN + " version " + Project.PROGRAM_VERSION_HUMAN + " build " + Project.PROGRAM_VERSION_RELEASEDATE;
            licenseLabel.Text = "Open Source - no known origin";
            Project.setDlgIcon(this);

            // try loading logo file:
            string logoFileName = Project.GetMiscPath("about.jpg");
            try
            {
                if(!File.Exists(logoFileName))
                {
                    // load the file remotely, don't hold diagnostics if load fails:
                    string url = Project.MISC_FOLDER_URL + "/about.jpg";
                    DloadProgressForm loaderForm = new DloadProgressForm(url, logoFileName, false, true);
                    loaderForm.ShowDialog();
                }
                logoPictureBox.Image = new Bitmap(logoFileName);
            }
            catch {}
        }
예제 #5
0
        private void showHelp()
        {
            string fileName = Project.GetMiscPath(Project.HELP_FILE_PATH);

            if(File.Exists(fileName)
                && (!Project.serverAvailable || File.GetLastWriteTime(fileName).CompareTo(Project.HELP_FILE_DATE) > 0))
            {
                Help.ShowHelp(this, fileName);
            }
            else if(Project.serverAvailable)
            {
                // load the file remotely:
                DloadProgressForm loaderForm = new DloadProgressForm(Project.HELP_FILE_URL, fileName, true, false);
                loaderForm.ShowDialog();
            }
            else
            {
                Project.ErrorBox(this, "Need to connect to the Internet to download Help file");
            }
        }
예제 #6
0
        private void sampleFileZippedEnsureAndOpen(string url, string sampleZipFileName, string entryName)
        {
            string sampleZipFilePath = Project.GetSamplePath(sampleZipFileName);
            string sampleFilePath = Project.GetSamplePath(entryName);

            try
            {
                if(!File.Exists(sampleZipFilePath))
                {
                    // load the file remotely, don't hold diagnostics if load fails:
                    DloadProgressForm loaderForm = new DloadProgressForm(url, sampleZipFilePath, false, false);
                    loaderForm.ShowDialog();
                }

                if(File.Exists(sampleZipFilePath) && !File.Exists(sampleFilePath))
                {
                    FileAndZipIO.unzipOneFile(sampleZipFilePath, entryName, sampleFilePath);
                }

                if(File.Exists(sampleFilePath))
                {
                    string[] fileNames = new string[] { sampleFilePath };

                    bool anySuccess = FileAndZipIO.readFiles(fileNames);

                    if(anySuccess)	// we need to zoom into whole set of dropped files, or refresh in case of JPG
                    {
                        this.wptEnabled(true);
                        if(!m_cameraManager.zoomToCorners())
                        {
                            m_cameraManager.ProcessCameraMove();	// nowhere to zoom in - just refresh
                        }
                    }
                    LibSys.StatusBar.Trace("* Ready");
                }
                else
                {
                    Project.ErrorBox(this, "Error: could not locate unzipped sample file " + sampleFilePath);
                }
            }
            catch
            {
                Project.ErrorBox(this, "Error: could not download sample file " + url);
            }
        }
예제 #7
0
 private void loadSetDlgIcon()
 {
     // try loading icon file (will be used for Project.setDlgIcon() for all dialogs):
     string iconFileName = Project.GetMiscPath(Project.PROGRAM_NAME_HUMAN + ".ico");
     try
     {
         if(!File.Exists(iconFileName))
         {
             // load the file remotely, don't hold diagnostics if load fails:
             string url = Project.MISC_FOLDER_URL + "/" + Project.PROGRAM_NAME_HUMAN + ".ico";
             DloadProgressForm loaderForm = new DloadProgressForm(url, iconFileName, false, true);
             loaderForm.ShowDialog();
         }
         this.Icon = new Icon(iconFileName);
     }
     catch {}
 }
예제 #8
0
        public AboutForm()
        {
            InitializeComponent();

            this.Text = "About " + Project.PROGRAM_NAME_HUMAN;
            versionLabel.Text = Project.PROGRAM_NAME_HUMAN + " version " + Project.PROGRAM_VERSION_HUMAN + " build " + Project.PROGRAM_VERSION_RELEASEDATE;

            this.gpsbabelLinkLabel.Text = Project.GPSBABEL_URL;

            creditsLabel.Text = "Included here is GPSBabel - a program by Robert Lipe\n\nPlease visit www.gpsbabel.org for more info.";

            Project.setDlgIcon(this);

            // try loading logo file:
            string logoFileName = Project.GetMiscPath("about.jpg");
            try
            {
                if(!File.Exists(logoFileName))
                {
                    // load the file remotely, don't hold diagnostics if load fails:
                    string url = Project.MISC_FOLDER_URL + "/about.jpg";
                    DloadProgressForm loaderForm = new DloadProgressForm(url, logoFileName, false, true);
                    loaderForm.ShowDialog();
                }
                logoPictureBox.Image = new Bitmap(logoFileName);
            }
            catch {}
        }