コード例 #1
0
        private void BtnLogin_Click(object sender, RoutedEventArgs e)
        {
            string firstname = TbFirstname.Text, lastname = TbLastname.Text, email = TbEmail.Text;

            if (firstname != "" && lastname != "" && email != "")
            {
                if (email.Length >= 5 && email.Contains("@") && email.Contains("."))
                {
                    MyPersonnalMapData mapData = new MyPersonnalMapData(firstname, lastname, email);

                    MappingWindow mappingWindow = new MappingWindow(mapData);
                    mappingWindow.Show();

                    Close();
                }
                else
                {
                    MessageBox.Show("Veillez indiquer une adresse e-mail valide.", "Erreur!", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            }
            else
            {
                MessageBox.Show("Veillez compléter tous les champs", "Erreur!", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
コード例 #2
0
        public MappingWindow(MyPersonnalMapData mapData)
        {
            InitializeComponent();

            MapData = mapData;

            CurrentTravel     = new MyCartographyObjects.Polyline();
            CurrentTravel.Tag = new MapPolyline()
            {
                Stroke          = new SolidColorBrush(CurrentTravel.Stroke),
                StrokeThickness = CurrentTravel.Thickness,
                Opacity         = CurrentTravel.Opacity,
                Locations       = new LocationCollection()
            };
            CurrentSurface     = new MyCartographyObjects.Polygon();
            CurrentSurface.Tag = new MapPolygon()
            {
                Fill            = new SolidColorBrush(CurrentSurface.Fill),
                Stroke          = new SolidColorBrush(CurrentSurface.Stroke),
                StrokeThickness = CurrentSurface.Thickness,
                Opacity         = CurrentSurface.Opacity,
                Locations       = new LocationCollection()
            };

            string sessionFileFullPath = MyPersonnalMapData.BINARIES_DIR + "\\" + MapData.GetSessionFilename();

            if (File.Exists(sessionFileFullPath))   // If the user has a session file
            {
                LoadBinaryFile(MyPersonnalMapData.BINARIES_DIR + "\\" + MapData.GetSessionFilename());
            }
            else
            {
                File.WriteAllText(sessionFileFullPath, ""); // If not, we create a new file without any data
            }

            UpdateLbCartographyObjectsItemsSource();
        }