private void BTNAddRoomSubtype_Click(object sender, RoutedEventArgs e)
        {
            WindowWithStringResult w = new WindowWithStringResult(
                (name) =>
                {
                    InteriorObjectType typ = (sender as Button).DataContext as InteriorObjectType;

                    if (typ.child.Count == 1 && typ.child[0].category == UIElementCategory.Undefined)
                    {
                        var products = typ.child[0].products;
                        InteriorObjectSubtype subTyp = new InteriorObjectSubtype(string.IsNullOrEmpty(name) ? UIElementCategory.Undefined : UIElementCategory.ProductTypeType);
                        subTyp.products = products;
                        subTyp.uidisplayname = name;
                        subTyp.id = 0;
                        subTyp.parentid = typ.id;

                        typ.child[0] = subTyp;
                    }
                    else
                    {

                        InteriorObjectSubtype subTyp = new InteriorObjectSubtype(string.IsNullOrEmpty(name) ? UIElementCategory.Undefined : UIElementCategory.ProductTypeType);
                        subTyp.uidisplayname = name;
                        subTyp.parentid = typ.id;
                        subTyp.id = typ.child.Count > 0 ? typ.child.Max(x => x.id) + 1 : 0;

                        typ.child.Add(subTyp);
                    }

                    UpdateTree();
                });
            w.Owner = this;
            w.ShowDialog();
        }
Пример #2
0
        private void BTNAddRoomSubtype_Click(object sender, RoutedEventArgs e)
        {
            WindowWithStringResult w = new WindowWithStringResult(
                (name) =>
            {
                InteriorObjectType typ = (sender as Button).DataContext as InteriorObjectType;

                if (typ.child.Count == 1 && typ.child[0].category == UIElementCategory.Undefined)
                {
                    var products = typ.child[0].products;
                    InteriorObjectSubtype subTyp = new InteriorObjectSubtype(string.IsNullOrEmpty(name) ? UIElementCategory.Undefined : UIElementCategory.ProductTypeType);
                    subTyp.products      = products;
                    subTyp.uidisplayname = name;
                    subTyp.id            = 0;
                    subTyp.parentid      = typ.id;

                    typ.child[0] = subTyp;
                }
                else
                {
                    InteriorObjectSubtype subTyp = new InteriorObjectSubtype(string.IsNullOrEmpty(name) ? UIElementCategory.Undefined : UIElementCategory.ProductTypeType);
                    subTyp.uidisplayname         = name;
                    subTyp.parentid = typ.id;
                    subTyp.id       = typ.child.Count > 0 ? typ.child.Max(x => x.id) + 1 : 0;

                    typ.child.Add(subTyp);
                }

                UpdateTree();
            });

            w.Owner = this;
            w.ShowDialog();
        }
Пример #3
0
        private void BTNRenameType_Click(object sender, RoutedEventArgs e)
        {
            InteriorObjectType     room = (sender as Button).DataContext as InteriorObjectType;
            WindowWithStringResult w    = new WindowWithStringResult((name) =>
            {
                room.uidisplayname = name;
                UpdateTree();
            });

            w.ShowDialog();
        }
Пример #4
0
        private void BTNRenameSubType_Click(object sender, RoutedEventArgs e)
        {
            InteriorObjectSubtype  room = (sender as Button).DataContext as InteriorObjectSubtype;
            WindowWithStringResult w    = new WindowWithStringResult((name) =>
            {
                room.uidisplayname = name;
                room.category      = string.IsNullOrEmpty(name) ? UIElementCategory.Undefined : UIElementCategory.ProductTypeType;
                UpdateTree();
            });

            w.ShowDialog();
        }
Пример #5
0
        private void BTNAddRoom_Click(object sender, RoutedEventArgs e)
        {
            WindowWithStringResult w = new WindowWithStringResult(
                (name) =>
            {
                RoomItem room      = new RoomItem();
                room.uidisplayname = name;
                room.id            = json.elements.Count > 0 ? json.elements.Max(x => x.id) + 1 : 0;
                json.elements.Add(room);

                UpdateTree();
            });

            w.Owner = this;
            w.ShowDialog();
        }
Пример #6
0
        private void BTNOpenJsonFromURL_Click(object sender, RoutedEventArgs e)
        {
            WindowWithStringResult w = new WindowWithStringResult(async(path) =>
            {
                var result = string.Empty;
                using (var webClient = new System.Net.WebClient())
                {
                    try
                    {
                        result = await webClient.DownloadStringTaskAsync(new Uri(path));
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("Nepodarilo sa stiahnut json");
                        return;
                    }

                    if (!string.IsNullOrEmpty(result))
                    {
                        jsonBase = await Task.Factory.StartNew(() =>
                        {
                            JsonBase b;
                            try
                            {
                                b = JsonConvert.DeserializeObject <JsonBase>(result, settings);
                            }
                            catch (Exception)
                            {
                                MessageBox.Show("Neplatny json");
                                return(null);
                            }
                            return(b);
                        });

                        TXTSkyboxpath.Text                  = jsonBase.SkyboxPath;
                        ButtonSaveFile.IsEnabled            = true;
                        ButtonManageDW.IsEnabled            = true;
                        ButtonAddInterior.IsEnabled         = true;
                        ButtonManageManufacturers.IsEnabled = true;
                        ButtonManageRooms.IsEnabled         = true;
                        BTNEditProducts.IsEnabled           = true;
                    }
                }
            });

            w.ShowDialog();
        }
Пример #7
0
        private void BTNAddRoomType_Click(object sender, RoutedEventArgs e)
        {
            WindowWithStringResult w = new WindowWithStringResult(
                (name) =>
            {
                RoomItem room = (sender as Button).DataContext as RoomItem;

                InteriorObjectType typ = new InteriorObjectType();
                typ.uidisplayname      = name;
                typ.id = room.child.Count > 0 ? room.child.Max(x => x.id) + 1 : 0;
                room.child.Add(typ);

                UpdateTree();
            });

            w.Owner = this;
            w.ShowDialog();
        }
Пример #8
0
        private void BTNAddRoom_Click(object sender, RoutedEventArgs e)
        {
            WindowWithStringResult addWindow = new WindowWithStringResult(
                (name) =>
            {
                RoomItem newRoom      = new RoomItem();
                newRoom.uidisplayname = name;
                newRoom.id            = mRooms.Max(x => x.id) + 1;
                mRooms.Add(newRoom);

                List <RoomItem> availableRooms = new List <RoomItem>(mRooms);

                CBRoom.ItemsSource   = availableRooms;
                CBRoom.SelectedIndex = availableRooms.Count - 1;
            });

            addWindow.Show();
        }
        private void BTNAddRoom_Click(object sender, RoutedEventArgs e)
        {
            WindowWithStringResult w = new WindowWithStringResult(
                (name) =>
                    {
                        RoomItem room = new RoomItem();
                        room.uidisplayname = name;
                        room.id = json.elements.Count > 0 ? json.elements.Max(x => x.id) + 1 : 0;
                        json.elements.Add(room);

                        UpdateTree();
                    });
            w.Owner = this;
            w.ShowDialog();
        }
        private void BTNAddRoomType_Click(object sender, RoutedEventArgs e)
        {
            WindowWithStringResult w = new WindowWithStringResult(
                (name) =>
                {
                    RoomItem room = (sender as Button).DataContext as RoomItem;

                    InteriorObjectType typ = new InteriorObjectType();
                    typ.uidisplayname = name;
                    typ.id = room.child.Count > 0 ? room.child.Max(x => x.id) + 1 : 0;
                    room.child.Add(typ);

                    UpdateTree();
                });
            w.Owner = this;
            w.ShowDialog();
        }
 private void BTNRenameType_Click(object sender, RoutedEventArgs e)
 {
     InteriorObjectType room = (sender as Button).DataContext as InteriorObjectType;
     WindowWithStringResult w = new WindowWithStringResult((name) =>
     {
         room.uidisplayname = name;
         UpdateTree();
     });
     w.ShowDialog();
 }
 private void BTNRenameSubType_Click(object sender, RoutedEventArgs e)
 {
     InteriorObjectSubtype room = (sender as Button).DataContext as InteriorObjectSubtype;
     WindowWithStringResult w = new WindowWithStringResult((name) =>
     {
         room.uidisplayname = name;
         room.category = string.IsNullOrEmpty(name) ? UIElementCategory.Undefined : UIElementCategory.ProductTypeType;
         UpdateTree();
     });
     w.ShowDialog();
 }
Пример #13
0
        private void BTNAddRoom_Click(object sender, RoutedEventArgs e)
        {
            WindowWithStringResult addWindow = new WindowWithStringResult(
                (name) =>
                {
                    RoomItem newRoom = new RoomItem();
                    newRoom.uidisplayname = name;
                    newRoom.id = mRooms.Max(x => x.id) + 1;
                    mRooms.Add(newRoom);

                    List<RoomItem> availableRooms = new List<RoomItem>(mRooms);

                    CBRoom.ItemsSource = availableRooms;
                    CBRoom.SelectedIndex = availableRooms.Count - 1;
                });
            addWindow.Show();
        }
Пример #14
0
        private void BTNOpenJsonFromURL_Click(object sender, RoutedEventArgs e)
        {
            WindowWithStringResult w = new WindowWithStringResult(async (path) =>
            {
                var result = string.Empty;
                using (var webClient = new System.Net.WebClient())
                {
                    try
                    {
                        result = await webClient.DownloadStringTaskAsync(new Uri(path));
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("Nepodarilo sa stiahnut json");
                        return;
                    }

                    if (!string.IsNullOrEmpty(result))
                    {
                        jsonBase = await Task.Factory.StartNew(() => 
                            {
                                JsonBase b;
                                try
                                {
                                    b = JsonConvert.DeserializeObject<JsonBase>(result, settings);
                                }
                                catch(Exception)
                                {
                                    MessageBox.Show("Neplatny json");
                                    return null;
                                }
                                return b;
                            });

                        TXTSkyboxpath.Text = jsonBase.SkyboxPath;
                        ButtonSaveFile.IsEnabled = true;
                        ButtonManageDW.IsEnabled = true;
                        ButtonAddInterior.IsEnabled = true;
                        ButtonManageManufacturers.IsEnabled = true;
                        ButtonManageRooms.IsEnabled = true;
                        BTNEditProducts.IsEnabled = true;
                    }
                }
            });
            w.ShowDialog();
        }