示例#1
0
        private static Control GetIncludeBorderCrossing(Journey journey)
        {
            var checkbox = new CheckBox();

            checkbox.DataContext = journey;
            checkbox.BindDataContext(c => c.Checked, (Journey m) => m.IncludeBorderCrossing);
            checkbox.Tag = "Include a border crossing";

            return(ViewHelper.Labelize(checkbox, 160));
        }
示例#2
0
        private static Control GetWeatherDropDown(Journey journey)
        {
            ComboBox weatherDropDown = new ComboBox();

            weatherDropDown.DataContext  = journey;
            weatherDropDown.AutoComplete = true;
            weatherDropDown.DataStore    = ConstantManager.Instance.WeatherKinds;
            weatherDropDown.BindDataContext(c => c.SelectedValue, (Journey m) => m.Weather);
            weatherDropDown.Tag = "Weather";

            return(ViewHelper.Labelize(weatherDropDown));
        }
示例#3
0
        private static Control GetNoteSlider(Journey journey)
        {
            ComboBox noteDropDown = new ComboBox();

            noteDropDown.DataContext = journey;
            noteDropDown.DataStore   = ConstantManager.Instance.Notes;
            noteDropDown.BindDataContext(c => c.SelectedKey, (Journey m) => m.Note);
            noteDropDown.TextColor = Colors.Gold;
            noteDropDown.Tag       = "Note";


            return(ViewHelper.Labelize(noteDropDown));
        }
示例#4
0
        public static Control GetView(BorderCrossing borderCrossing)
        {
            NumericUpDown visaDuration = new NumericUpDown();

            visaDuration.DataContext = borderCrossing;
            visaDuration.BindDataContext(c => c.Value, (BorderCrossing m) => m.VisaDuration);
            visaDuration.Tag   = "Visa Duration";
            visaDuration.Width = 50;

            NumericUpDown visaPrice = new NumericUpDown();

            visaPrice.DataContext = borderCrossing;
            visaPrice.BindDataContext(c => c.Value, (BorderCrossing m) => m.VisaPrice);
            visaPrice.Tag   = "Visa Price";
            visaPrice.Width = 50;


            NumericUpDown visaVehicleDuration = new NumericUpDown();

            visaVehicleDuration.DataContext = borderCrossing;
            visaVehicleDuration.BindDataContext(c => c.Value, (BorderCrossing m) => m.VisaVehicleDuration);
            visaVehicleDuration.Tag   = "Visa Vehicle Duration";
            visaVehicleDuration.Width = 50;

            NumericUpDown visaVehiclePrice = new NumericUpDown();

            visaVehiclePrice.DataContext = borderCrossing;
            visaVehiclePrice.BindDataContext(c => c.Value, (BorderCrossing m) => m.VisaVehiclePrice);
            visaVehiclePrice.Tag   = "Visa Vehicle Price";
            visaVehiclePrice.Width = 50;



            CheckBox fumigation = new CheckBox();

            fumigation.DataContext = borderCrossing;
            fumigation.BindDataContext(c => c.Checked, (BorderCrossing m) => m.Fumigation);
            fumigation.Tag   = "Fumigation";
            fumigation.Width = 50;

            NumericUpDown fumigationPrice = new NumericUpDown();

            fumigationPrice.DataContext = borderCrossing;
            fumigationPrice.BindDataContext(c => c.Value, (BorderCrossing m) => m.FumigationPrice);
            fumigationPrice.Tag   = "Fumigation Price";
            fumigationPrice.Width = 50;



            CheckBox vehicleInspection = new CheckBox();

            vehicleInspection.DataContext = borderCrossing;
            vehicleInspection.BindDataContext(c => c.Checked, (BorderCrossing m) => m.VehicleInspection);
            vehicleInspection.Tag   = "Vehicle Inspection";
            vehicleInspection.Width = 50;



            CheckBox tramidores = new CheckBox();

            tramidores.DataContext = borderCrossing;
            tramidores.BindDataContext(c => c.Checked, (BorderCrossing m) => m.Tramidores);
            tramidores.Tag   = "Tramidores";
            tramidores.Width = 50;

            NumericUpDown tramidoresPrice = new NumericUpDown();

            tramidoresPrice.DataContext = borderCrossing;
            tramidoresPrice.BindDataContext(c => c.Value, (BorderCrossing m) => m.TramidoresPrice);
            tramidoresPrice.Tag   = "Tramidores Price";
            tramidoresPrice.Width = 50;

            TextArea comments = new TextArea();

            comments.DataContext = borderCrossing;
            comments.BindDataContext(c => c.Text, (Bivouac m) => m.Comments);

            var font = new Font("Helvetica", 13, FontStyle.Italic);
            var info = new Label()
            {
                Text = "Prices expressed in euros and duration expressed in days.",
            };

            info.Font = font;

            var row1 = ViewHelper.AppendH(ViewHelper.Labelize(visaDuration, 130), ViewHelper.Labelize(visaVehicleDuration, 130), ViewHelper.Labelize(fumigation, 130), ViewHelper.Labelize(tramidores, 130));
            var row2 = ViewHelper.AppendH(ViewHelper.Labelize(visaPrice, 130), ViewHelper.Labelize(visaVehiclePrice, 130), ViewHelper.Labelize(fumigationPrice, 130), ViewHelper.Labelize(tramidoresPrice, 130));
            var row3 = ViewHelper.AppendH(ViewHelper.Labelize(vehicleInspection, 130), null);

            var layout = ViewHelper.AppendV(new Panel()
            {
                Content = info, Padding = new Padding(0, 10)
            }, row1, row2, row3, new Panel()
            {
                Content = comments, Padding = new Padding(0, 10)
            });

            return(new Panel()
            {
                Content = layout, Padding = new Padding(10, 0)
            });
        }
示例#5
0
        public static Control GetView(Bivouac bivouac)
        {
            ComboBox typeDropDown = new ComboBox();

            typeDropDown.DataContext = bivouac;
            typeDropDown.DataStore   = ConstantManager.Instance.BivouacTypes;
            typeDropDown.BindDataContext(c => c.SelectedKey, (Bivouac m) => m.Type);
            typeDropDown.Tag = "Type";

            ComboBox noteDropDown = new ComboBox();

            noteDropDown.DataContext = bivouac;
            noteDropDown.DataStore   = ConstantManager.Instance.Notes;
            noteDropDown.BindDataContext(c => c.SelectedKey, (Bivouac m) => m.Note);
            noteDropDown.TextColor = Colors.Gold;
            noteDropDown.Tag       = "Note";

            TextBox addressTextBox = new TextBox();

            addressTextBox.DataContext = bivouac;
            addressTextBox.BindDataContext(c => c.Text, (Bivouac m) => m.Address);
            addressTextBox.Tag = "Address";

            TextBox cityTextBox = new TextBox();

            cityTextBox.DataContext = bivouac;
            cityTextBox.BindDataContext(c => c.Text, (Bivouac m) => m.City);
            cityTextBox.Tag = "City";

            ComboBox countryDropDown = new ComboBox();

            countryDropDown.DataContext = bivouac;
            countryDropDown.DataStore   = ConstantManager.Instance.Countries;
            countryDropDown.BindDataContext(c => c.SelectedKey, (Bivouac m) => m.Country);
            countryDropDown.Tag = "Country";

            TextBox coordinatesTextBox = new TextBox();

            coordinatesTextBox.DataContext = bivouac;
            coordinatesTextBox.BindDataContext(c => c.Text, (Bivouac m) => m.Coordinates);
            coordinatesTextBox.Tag = "Lat, Long";

            NumericStepper elevationNumericUpDown = new NumericStepper();

            elevationNumericUpDown.DataContext = bivouac;
            elevationNumericUpDown.BindDataContext(c => c.Value, (Bivouac m) => m.Elevation);
            elevationNumericUpDown.Tag = "Height (m)";

            NumericStepper distanceNumericUpDown = new NumericStepper();

            distanceNumericUpDown.DataContext = bivouac;
            distanceNumericUpDown.BindDataContext(c => c.Value, (Bivouac m) => m.Distance);
            distanceNumericUpDown.Tag = "Total (km)";

            NumericStepper distanceTrackNumericUpDown = new NumericStepper();

            distanceTrackNumericUpDown.DataContext = bivouac;
            distanceTrackNumericUpDown.BindDataContext(c => c.Value, (Bivouac m) => m.DistanceTrack);
            distanceTrackNumericUpDown.Tag = "Track (km)";

            NumericStepper walkNumericUpDown = new NumericStepper();

            walkNumericUpDown.DataContext = bivouac;
            walkNumericUpDown.BindDataContext(c => c.Value, (Bivouac m) => m.Walk);
            walkNumericUpDown.Tag = "Walk (m)";

            NumericStepper wakeUpTemperatureNumericUpDown = new NumericStepper();

            wakeUpTemperatureNumericUpDown.DataContext = bivouac;
            wakeUpTemperatureNumericUpDown.BindDataContext(c => c.Value, (Bivouac m) => m.WakeUpTemperature);
            wakeUpTemperatureNumericUpDown.Tag = "Wake T (C°)";

            CheckBox photoCheckBox = new CheckBox();

            photoCheckBox.DataContext = bivouac;
            photoCheckBox.BindDataContext(c => c.Checked, (Bivouac m) => m.Photo);
            photoCheckBox.Tag   = "Photo";
            photoCheckBox.Width = 14;

            CheckBox fromiOverLanderCheckBox = new CheckBox();

            fromiOverLanderCheckBox.DataContext = bivouac;
            fromiOverLanderCheckBox.BindDataContext(c => c.Checked, (Bivouac m) => m.FromIOverLander);
            fromiOverLanderCheckBox.Tag   = "iOverLander";
            fromiOverLanderCheckBox.Width = 14;

            CheckBox toiOverLanderCheckBox = new CheckBox();

            toiOverLanderCheckBox.DataContext = bivouac;
            toiOverLanderCheckBox.BindDataContext(c => c.Checked, (Bivouac m) => m.ToIOverLander);
            toiOverLanderCheckBox.Tag   = "Shared";
            toiOverLanderCheckBox.Width = 14;

            TextArea commentTextArea = new TextArea();

            commentTextArea.DataContext = bivouac;
            commentTextArea.BindDataContext(c => c.Text, (Bivouac m) => m.Comments);

            GridView tagsGrid = new GridView();

            tagsGrid.DataStore  = bivouac.GetBivouacTags();
            tagsGrid.ShowHeader = false;
            tagsGrid.Width      = 170;

            tagsGrid.Columns.Add(new GridColumn
            {
                DataCell = new CheckBoxCell {
                    Binding = Binding.Property <Tag, bool?>(r => r.IsChecked)
                },
                Editable = true
            });

            tagsGrid.Columns.Add(new GridColumn
            {
                DataCell = new TextBoxCell {
                    Binding = Binding.Property <Tag, string>(r => r.Name)
                },
                Editable = false
            });

            var infoColumn = ViewHelper.AppendV(
                ViewHelper.AppendH(ViewHelper.Labelize(typeDropDown), ViewHelper.Labelize(addressTextBox)),
                ViewHelper.AppendH(ViewHelper.Labelize(noteDropDown), ViewHelper.Labelize(cityTextBox), ViewHelper.Labelize(elevationNumericUpDown)),
                ViewHelper.AppendH(ViewHelper.Labelize(wakeUpTemperatureNumericUpDown), ViewHelper.Labelize(countryDropDown)),
                ViewHelper.AppendH(ViewHelper.Labelize(distanceNumericUpDown), ViewHelper.Labelize(coordinatesTextBox)),
                ViewHelper.AppendH(ViewHelper.Labelize(distanceTrackNumericUpDown), ViewHelper.Labelize(elevationNumericUpDown)),
                ViewHelper.AppendH(ViewHelper.Labelize(walkNumericUpDown), ViewHelper.Labelize(photoCheckBox, 42), ViewHelper.Labelize(fromiOverLanderCheckBox, 79), ViewHelper.Labelize(toiOverLanderCheckBox, 49))
                );

            return(new GroupBox()
            {
                Padding = 5, Content = ViewHelper.AppendH(infoColumn, tagsGrid, new Label()
                {
                    Width = 20
                }, commentTextArea), Text = "Bivouac"
            });
        }