private void miClose_Click(object sender, RoutedEventArgs e)
 {
     if (OnClose != null)
     {
         OptionsAccess.ForceClose();
         OnClose();
     }
 }
Exemple #2
0
        private void ButtonChooseLanguage_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.CheckFileExists  = true;
            ofd.InitialDirectory = OptionsAccess.getFolderPath(ApplicationFolder.Language);

            ofd.Filter = OptionsAccess.Language.getLanguageString(461);
            if (ofd.ShowDialog() == true)
            {
                if (System.IO.Path.GetDirectoryName(ofd.FileName) == OptionsAccess.getFolderPath(ApplicationFolder.Language))
                {
                    this.textBoxLanguageFile.Text = System.IO.Path.GetFileName(ofd.FileName);
                }
                else
                {
                    MessageBox.Show(OptionsAccess.Language.getLanguageString(429));
                }
            }
        }
Exemple #3
0
 /**
  * Konstruktor
  * Neben den default-Optionen kann bei Bedarf eine weitere Userspezifische
  * Einstellung abgespeichert werden.
  * Die Pfade zu den beiden Dateien sind hier zu übergeben.
  */
 public OptionsXMLSerializer(string defaultOptionsFileName, string userOptionsFileName)
 {
     this.defaultOptionsFilePath = OptionsAccess.getFolderPath(ApplicationFolder.Settings) + "\\" + defaultOptionsFileName;
     this.userOptionsFilePath    = OptionsAccess.getFolderPath(ApplicationFolder.Settings) + "\\" + userOptionsFileName;
 }
 private void miOptions_Click(object sender, RoutedEventArgs e)
 {
     OptionsAccess.ShowOptionsDialog();
 }
Exemple #5
0
        private void saveGoogleMapToLocalMachine()
        {
            Object url;

            if (OptionsAccess.MapSaveOptions.UseDeviceDimensions)
            {
                Object[] obj = new Object[2];
                obj[0] = (Object)DeviceWidth;
                obj[1] = (Object)DeviceHeight;

                url = webbrowserMap.InvokeScript("loadImageWithParam", obj);
            }
            else
            {
                url = webbrowserMap.InvokeScript("loadImage");
            }

            StringBuilder builder = new StringBuilder();

            builder.Append(OptionsAccess.getFolderPath(ApplicationFolder.Maps));
            builder.Append(@"\");
            builder.Append(this.textBoxFile.Text.Trim());
            builder.Append(".png");

            String localFileName = builder.ToString();

            if (this.DownloadFile(url.ToString(), localFileName) > 0)
            {
                builder = new StringBuilder();
                builder.Append(OptionsAccess.getFolderPath(ApplicationFolder.Maps));
                builder.Append(@"\");
                builder.Append(this.textBoxFile.Text.Trim());
                builder.Append(".xml");


                MapInfo.Name        = this.textBoxFile.Text.Trim();
                MapInfo.Description = this.textBoxDescription.Text.Trim();

                if (webbrowserMap.Document != null)
                {
                    Object temp;
                    temp          = webbrowserMap.InvokeScript("getSWLatitude");
                    MapInfo.SWLat = float.Parse(temp.ToString());
                    MapInfo.SELat = float.Parse(temp.ToString());

                    temp           = webbrowserMap.InvokeScript("getSWLongitude");
                    MapInfo.SWLong = float.Parse(temp.ToString());

                    temp          = webbrowserMap.InvokeScript("getNELatitude");
                    MapInfo.NELat = float.Parse(temp.ToString());

                    temp           = webbrowserMap.InvokeScript("getNELongitude");
                    MapInfo.NELong = float.Parse(temp.ToString());
                    MapInfo.SELong = float.Parse(temp.ToString());

                    temp = webbrowserMap.InvokeScript("getZoomLevel");
                    MapInfo.ZoomLevel = int.Parse(temp.ToString());
                }

                this.writeSettingsToXML(builder.ToString());

                this.textBoxDescription.Clear();
                this.textBoxFile.Clear();
            }
        }
Exemple #6
0
        public MapsWindow()
        {
            InitializeComponent();
            DataContext = this;
            RefreshLanguage();

            checkBoxDeviceSize.IsChecked = OptionsAccess.MapSaveOptions.UseDeviceDimensions;
            if (GoogleMap)
            {
                string mapsHTML = OptionsAccess.getFolderPath(ApplicationFolder.Application) + @"\Maps\GoogleMap.html";
                if (!File.Exists(mapsHTML))
                {
                    //Log
                }
                else
                {
                    webbrowserMap.Source             = new Uri(mapsHTML);
                    webbrowserMap.ObjectForScripting = new MapsCOMInterface(this);

                    webbrowserMap.Loaded += new RoutedEventHandler(webbrowserMap_Loaded);
                }

                /*try
                 * {
                 *  rapi = new RAPI();
                 *
                 *  if (rapi.DevicePresent)
                 *  {
                 *      this.setMobileSize(rapi.GetDeviceCapabilities(DeviceCaps.HorizontalResolution), rapi.GetDeviceCapabilities(DeviceCaps.VerticalResolution));
                 *  }
                 * }
                 * catch (Exception)
                 * {
                 *  //TODO Log
                 * }*/
            }
            else
            {
                /*try
                 * {
                 *  OpenFileDialog dlg = new OpenFileDialog();
                 *  dlg.Title = "Choose map to be shown";
                 *  dlg.Filter = "JPEG (*.JPEG, *.JPG)|*.jpg;*.jpeg|GIF (*.gif)|*.gif|PNG (*.png)|*.png|Bitmap (*.bmp)|*.bmp";
                 *  if (dlg.ShowDialog() == true)
                 *  {
                 *      imageMap = zoomImage(new Bitmap(dlg.FileName));
                 *      readSettingsFromXML(Path.GetDirectoryName(dlg.FileName), Path.GetFileNameWithoutExtension(dlg.FileName));
                 *
                 *      deltaX = (pictureBoxMap.Width - pictureBoxMap.Image.Width) / 2;
                 *      deltaY = (pictureBoxMap.Height - pictureBoxMap.Image.Height) / 2;
                 *      showOverlay();
                 *  }
                 *
                 *  webbrowserMap.Visible = false;
                 *  pictureBoxMap.Visible = true;
                 *  this.groupBoxGoogleMap.Enabled = false;
                 *  this.groupBoxMap.Enabled = true;
                 *  showToolStripMenuItem.Enabled = false;
                 *  openMapToolStripMenuItem.Enabled = true;
                 * }
                 * catch (Exception)
                 * {
                 *  throw new DataFunctionsException("Exception while opening map and reading settings from XML file.");
                 * }*/
            }
        }