Пример #1
0
        public HydroSystemsDataGrid(EntitiesCollections entitiesCollections) : base(entitiesCollections)
        {
            InitializeComponent();

            HydroSystemsCollectionViewModel items = ItemsSource as HydroSystemsCollectionViewModel;

            if (items.Count == 1)
            {
                HydroSystemViewModel item = items[0] as HydroSystemViewModel;
                if (item.Name == null)
                {
                    CurrentColumn         = NameColumn;
                    NameColumn.IsReadOnly = false;
                }
            }
        }
Пример #2
0
 void ObjectsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     if (e.Action == NotifyCollectionChangedAction.Remove)
     {
         try
         {
             foreach (object item in e.OldItems)
             {
                 HydroSystemViewModel UIObject = item as HydroSystemViewModel;
                 HydroSystemsDataAccess.DeleteObject(UIObject.GetDataObject());
             }
         }
         catch (Exception ex)
         {
             log.Error(ex.StackTrace);
         }
     }
 }
Пример #3
0
        private void HydroSystemsListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            HydroSystemViewModel system = HydroSystemsListBox.SelectedItem as HydroSystemViewModel;

            if (system != null)
            {
                HydroSystemName = system.Name;
            }
            else
            {
                HydroSystemsListBox.SelectedIndex = 0;
                return;
            }
            HydroTopologyCollectionViewModel systemTopology = hydroTopologyDataProvider.GetSystemTopology(HydroSystemName);

            SystemTopologyGrid.ItemsSource = systemTopology;
            //RowLoaded += BaseDataGrid_Formating;
        }
Пример #4
0
        void ObjectsItemEndEdit(IEditableObject sender)
        {
            HydroSystemViewModel UIObject = sender as HydroSystemViewModel;

            try
            {
                if (UIObject.Name != null)
                {
                    int id = HydroSystemsDataAccess.UpdateObject(UIObject.GetDataObject());
                    if (id != -1)
                    {
                        UIObject.Id = id;
                    }
                }
            }
            catch
            {
                UIObjects.Remove(UIObject);
                RadWindow.Alert(new DialogParameters
                {
                    Content = MessageUtil.FormatMessage("ERROR.DuplicatedEntryName", UIObject.Name)
                });
            }
        }