Exemplo n.º 1
0
        public Zweirad(string file)
        {
            InitializeComponent();
            VersionStamp.Content = file;
            if (Regex.IsMatch(file, "Zweirad_([0-9]+)\\.bin", RegexOptions.IgnoreCase))
            {
                int id = Convert.ToInt32(Regex.Match(file, "Zweirad_([0-9]{1,})\\.bin").Groups[1].Value);
                this.ID = id;
            }
            this.Title = "Zweirad Eintrag ("+ID.ToString()+")";

            this.Data = new FileContents(file);
            this.Data.ReadFile();
            wpfc = new WPFcommunication();

            try
            {
                if (this.Data.Data.Bild != "")
                {
                    bih = new BaseImageHandler();
                    FahrzeugBild.Source = bih.Image2BitmapImage(bih.Base642Image(this.Data.Data.Bild));
                }
            }
            catch
            {
                this.Data.Data.Bild = "";
            }
            try
            {
                FahrzeugKurzname.Text = this.Data.Data.Bezeichnung;
            }
            catch { }
            ReloadLogbuch();
            try
            {
                Kilometer.Content = wpfc.ZKilometer(this.Data.Data.Logbuch);
            }
            catch
            {
                Kilometer.Content = "0";
                this.Data.Data.Kilometer = 0;
            }
            try
            {
                ar_date.SelectedDate = DateTime.Now;
                ar_hour.Text = DateTime.Now.Hour.ToString();
                ar_minute.Text = DateTime.Now.Minute.ToString();

                if (this.Data.Data.Verfügbar == true || this.Data.Data.Logbuch == null)
                {
                    ToggleVerleihVerfügbar(true);
                }
                else
                {
                    ToggleVerleihVerfügbar(false);
                }
            }
            catch { }
        }
Exemplo n.º 2
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
     dlg.Filter = "Image files (*.jpg, *.jpeg, *.jpe, *.jfif, *.png) | *.jpg; *.jpeg; *.jpe; *.jfif; *.png";
     Nullable<bool> result = dlg.ShowDialog();
     if (result == true)
     {
         bih = new BaseImageHandler();
         this.Data.Data.Bild = bih.Image2Base64(bih.Path2Image(dlg.FileName));
         FahrzeugBild.Source = bih.Image2BitmapImage(bih.Path2Image(dlg.FileName));
     }
 }