Esempio n. 1
0
        public Mapa()
        {
            InitializeComponent();

            tipoviTree = DodajTip.l;



            foreach (Ikonica ik in MapaIkonice.mapaIk)
            {
                Image Pikonica = Informacije(ik.Sp);


                canvasMapa.Children.Add(Pikonica);

                Canvas.SetLeft(Pikonica, ik.X);
                Canvas.SetTop(Pikonica, ik.Y);
            }


            Mi = new MapaIkonice();

            InstanceM = this;

            foreach (Tip t in DodajTip.l)
            {
                t.SpomeniciUtipu.Clear();
                Tip tipp = new Tip()
                {
                    Ime = t.Ime
                };
                foreach (Spomenik sp in DodajSpomenik.ls)
                {
                    if (t.Equals(sp.Tip))
                    {
                        t.SpomeniciUtipu.Add(sp);
                        foreach (Ikonica mi in MapaIkonice.mapaIk)
                        {
                            if (sp.Equals(mi.Sp))
                            {
                                t.SpomeniciUtipu.Remove(sp);
                            }
                        }
                    }
                }
            }

            this.DataContext    = this;
            mapaImg.ImageSource = new BitmapImage(new Uri("pack://siteoforigin:,,,/Images/mapa.jpg"));
        }
        private void LoadMap(Mapa mapa)
        {
            // remove all children that are of type Chip
            int intTotalChildren = MapGrid.Children.Count - 1;

            for (int intCounter = intTotalChildren; intCounter > 0; intCounter--)
            {
                if (MapGrid.Children[intCounter].GetType() == typeof(Chip))
                {
                    Chip ucCurrentChild = (Chip)MapGrid.Children[intCounter];
                    MapGrid.Children.Remove(ucCurrentChild);
                }
            }

            mapa.Pinovi.ToList().ForEach(LoadChipFromPin);
        }
Esempio n. 3
0
//////////////////////////////////////////////////OTVARANJE///////////////////////////////////////////////////////////
        public MainWindow()
        {
            /*string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
             * using (StreamReader reader = new StreamReader(System.IO.Path.Combine(path, "tipovi.txt")))
             * {
             *  string json1 = reader.ReadToEnd();
             *  string json4 = json1.Replace(@"\\\\", @"-");
             *  string json2 = json4.Replace(@"\", string.Empty);
             *  string json = json2.Replace(@"-", @"\\\\");
             *  List<Tip> res = JsonConvert.DeserializeObject<List<Tip>>(json.Trim().Substring(1, (json.Length - 2)));
             *  foreach (Tip t in res)
             *  {
             *      t.Ikonica = ByteArrayToBitmapImage(t.ByteIkonica);
             *  }
             *  DodajTip.l = res;
             * }
             *
             *
             * string path1 = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
             * using (StreamReader reader = new StreamReader(System.IO.Path.Combine(path, "etikete.txt")))
             * {
             *  string json1 = reader.ReadToEnd();
             *  string json4 = json1.Replace(@"\\\\", @"-");
             *  string json2 = json4.Replace(@"\", string.Empty);
             *  string json = json2.Replace(@"-", @"\\\\");
             *  List<Etiketa> res1 = JsonConvert.DeserializeObject<List<Etiketa>>(json.Trim().Substring(1, (json.Length - 2)));
             *  DodajEtiketu.le = res1;
             * }
             *
             * string path3 = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
             * using (StreamReader reader = new StreamReader(System.IO.Path.Combine(path, "spomenici.txt")))
             * {
             *  string json1 = reader.ReadToEnd();
             *  string json4 = json1.Replace(@"\\\\", @"-");
             *  string json2 = json4.Replace(@"\", string.Empty);
             *  string json = json2.Replace(@"-", @"\\\\");
             *  List<Spomenik> res2 = JsonConvert.DeserializeObject<List<Spomenik>>(json.Trim().Substring(1, (json.Length - 2)));
             *  foreach (Spomenik sp in res2)
             *  {
             *      sp.Ikonica = ByteArrayToBitmapImage(sp.ByteIkonica);
             *      //sp.Datum = DateTime.Parse(sp.StrDatum);
             *      foreach (Tip t in DodajTip.l)
             *      {
             *          if (t.Ime.Equals(sp.TipId))
             *          {
             *              sp.Tip = t;
             *          }
             *
             *      }
             *
             *      int broj = sp.EtId.Count();
             *
             *      foreach (String oz in sp.EtId)
             *      {
             *          foreach (Etiketa et in DodajEtiketu.le)
             *          {
             *              if (et.Oznaka.Equals(oz))
             *              {
             *                  sp.Etikete.Add(et);
             *
             *
             *              }
             *          }
             *      }
             *
             *  }
             *  DodajSpomenik.ls = res2;
             * }
             *
             * string path4 = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
             * using (StreamReader reader = new StreamReader(System.IO.Path.Combine(path, "ikonice.txt")))
             * {
             *  string json1 = reader.ReadToEnd();
             *  string json4 = json1.Replace(@"\\\\", @"-");
             *  string json2 = json4.Replace(@"\", string.Empty);
             *  string json = json2.Replace(@"-", @"\\\\");
             *  List<Ikonica> res4 = JsonConvert.DeserializeObject<List<Ikonica>>(json.Trim().Substring(1, (json.Length - 2)));
             *  MapaIkonice.mapaIk.Clear();
             *  foreach (Ikonica ic in res4)
             *  {
             *      foreach (Spomenik sp in DodajSpomenik.ls)
             *      {
             *          if (ic.SpId.Equals(sp.Id))
             *          {
             *              ic.Sp = sp;
             *              MapaIkonice.mapaIk.Add(ic);
             *          }
             *      }
             *  }
             *
             * } */

            InitializeComponent();
            mapa         = new Mapa();
            Main.Content = new Pocetna();
        }