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 { }
        }
        public MainWindow()
        {
            InitializeComponent();
            System.Version MyVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
            DateTime FCT = new DateTime(2000, 1, 1).AddDays(MyVersion.Build).AddSeconds(MyVersion.Revision * 2);
            VersionStamp.Content = "Build " + Assembly.GetExecutingAssembly().GetName().Version.ToString();
            VersionStamp.ToolTip = "Created on \n" + FCT.ToString("dd.MM.yyyy HH:mm:ss");

            EClose();

            wpfc = new WPFcommunication();
        }