Beispiel #1
0
        //Constructor
        public Maps(string MapsPath)
        {
            InitializeComponent();

            //Load Map Data & Binding
            MyMap = new MapPointViewModel(MapsPath, SystemParameters.PrimaryScreenWidth);
            DataContext = MyMap;

            //Set Canvas Size
            Cnv_Map.Width = System.Windows.SystemParameters.PrimaryScreenWidth;
            Cnv_Map.Height = System.Windows.SystemParameters.PrimaryScreenHeight;
            //Set List Size
            Lbx_Points.Height = System.Windows.SystemParameters.PrimaryScreenHeight - 280;
            //Load Skins Obj
            Cnv_Map.Background = ImgManger.LoadImageFromFile(GlobalVar.ImgBackground_A, ConfigVariable.UserSkin);
            this.Btn_Close.Source = ImgManger.LoadImageFromFile(ConfigVariable.UserSkin + GlobalVar.ImgClose);

            //Calc Aspecratio
            double AratCanvas = Cnv_Map.Width / Cnv_Map.Height;

            //Set Image Properties
            if (AratCanvas > MyMap.Aspectratio)
            {
                BorderImg.Height = Cnv_Map.Height;
                BorderImg.Width = BorderImg.Height * MyMap.Aspectratio;
            }
            else
            {
                BorderImg.Width = Cnv_Map.Width;
                BorderImg.Height = BorderImg.Width / MyMap.Aspectratio;
            }

            if (MyMap.ExistInfo) //If there are Points Information in the Map
            {
                InfoLabel = GUIMgr.CreateTextWithBorder("", "Calibri", 20);
                GridImg.Children.Add(InfoLabel);

                //Set Timer for List Close system
                ListTimer = new DispatcherTimer();
                ListTimer.Interval = TimeSpan.FromSeconds(50);
                ListTimer.Tick += ListAnimation;
                ListTimer.Start();
            }

            //Start Timer TimeOut
            CreateTimer();

            //Timer for Help Msg
            TimeCloseInf = new DispatcherTimer();
            TimeCloseInf.Interval = TimeSpan.FromSeconds(20);
            TimeCloseInf.Tick += Cbk_CloseMsg;
        }
        private IEnumerable <MapPointViewModel> GetMapPoints(IEnumerable <ShiftViewModel> shifts, IEnumerable <Location> locations)
        {
            List <MapPointViewModel> mapPoints = new List <MapPointViewModel>();

            foreach (var location in shifts.GroupBy(x => x.LocationName))
            {
                Address address = locations.Where(x => x.Name == location.Key).Select(x => x.Address).FirstOrDefault();

                MapPointViewModel mapPoint = new MapPointViewModel
                {
                    Location      = location.Key,
                    Address       = address?.Text,
                    ZipOrPostcode = address?.ZipOrPostcode,
                    Quantity      = location.Sum(x => x.Quantity),
                    Available     = location.Sum(x => x.Available),
                    Point         = location.Select(x => x.Point).FirstOrDefault(),
                    Start         = location.Select(x => x.Start).FirstOrDefault()
                };

                mapPoints.Add(mapPoint);
            }

            return(mapPoints);
        }