Добавьте файлы проекта.

This commit is contained in:
palex
2026-01-06 02:07:18 +03:00
parent 153b9675e3
commit 8e4b375e80
109 changed files with 10817 additions and 0 deletions

96
VM/StructuresVM.cs Normal file
View File

@@ -0,0 +1,96 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GroundOrganizer
{
public partial class ViewModel : INotifyPropertyChanged
{
int numStructure = 1;
string nameStructure;
private string structureNote;
Structure selectedStructure;
ObservableCollection<Structure> listStructure = new ObservableCollection<Structure>();
public ObservableCollection<Structure> ListStructure { get => listStructure; set { listStructure = value; OnPropertyChanged(); } }
private IEnumerable<TypeFlexStructure> listShemas;
public IEnumerable<TypeFlexStructure> ListShemas { get => listShemas; set { listShemas = value; OnPropertyChanged(); } }
public string StructureNote { get => structureNote; set { structureNote = value; OnPropertyChanged(); } }
private RelayCommand addStructure;
public RelayCommand AddStructure
{
get { return addStructure ?? (addStructure = new RelayCommand(obj => { AddStructureToList(); })); }
}
private RelayCommand updateStructure;
public RelayCommand UpdateStructures
{
get { return updateStructure ?? (updateStructure = new RelayCommand(obj => { UpdateStructureInList(); })); }
}
private RelayCommand renumStructure;
public RelayCommand RenumStructures
{
get { return renumStructure ?? (renumStructure = new RelayCommand(obj => { RenumberingStructureInList(); })); }
}
public Structure SelectedStructure { get => selectedStructure; set { selectedStructure = value; OnPropertyChanged(); ChangeSelectedStructure(); } }
public string NameStructure { get => nameStructure; set { nameStructure = value; OnPropertyChanged(); } }
void AddStructureToList()
{
ListStructure.Add(new Structure() { Number = numStructure }); numStructure++;
//NameStructure = listStructure[0].Name;
}
void RenumberingStructureInList()
{
int j = 1;
foreach (Structure item in ListStructure)
{
item.Number = j;
j++;
}
numStructure = j;
ListStructure = new ObservableCollection<Structure>(ListStructure);
}
void UpdateStructureInList()
{
ListStructure = new ObservableCollection<Structure>(ListStructure);
SaveDB();
}
void ChangeSelectedStructure()
{
if (listStructure.Count == 0 || selectedStructure == null) return;
NameStructure = selectedStructure.Name;
ListFoundation = selectedStructure.Foundations;
RedPlanning = selectedStructure.RedPlanning;
BlackPlanning = selectedStructure.BlackPlanning;
if (redPlanning == null) RedPlanning = new ObservableCollection<PlanningVertex>();
if (blackPlanning == null) BlackPlanning = new ObservableCollection<PlanningVertex>();
}
void CreateListShemas()
{
if (listStructure == null || listPlayGround == null) return;
ListShemas = new List<TypeFlexStructure>() { TypeFlexStructure.Гибкая, TypeFlexStructure.Жесткая };
try
{
StructuresPage structuresPage = (StructuresPage)MW.StructuresFrame.Content;
structuresPage.flexListCbxCol.ItemsSource = listShemas;
}
catch
{
return;
}
}
}
}