// Copyright (C) Stichting Deltares 2025. All rights reserved. // // This file is part of the application DAM - UI. // // DAM - UI is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see . // // All names, logos, and references to "Deltares" are registered trademarks of // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. using System.Xml.Serialization; using Deltares.Dam.Data; using Deltares.Standard; using Deltares.Standard.Attributes; using Deltares.Standard.EventPublisher; namespace Deltares.Dam.Forms { [Impact(Impact.None)] public class LocationJobSymbol : Symbol, IVisibleEnabled { private string currentProfileName; private string currentScenarioName; private string currentCalculation; private DamProjectData damProjectData; public LocationJobSymbol() { DataEventPublisher.OnAfterChange += DataEventPublisher_OnAfterChange; } [XmlIgnore] public string CurrentProfileName { get { return currentProfileName; } set { DataEventPublisher.BeforeChange(this, "CurrentProfileName"); currentProfileName = value; LocationJob.CurrentProfileName = value; DataEventPublisher.DataListModified(DamProjectData.LocationJobs); DataEventPublisher.AfterChange(this, "CurrentProfileName"); } } [XmlIgnore] public string CurrentScenarioName { get { return currentScenarioName; } set { DataEventPublisher.BeforeChange(this, "CurrentScenarioName"); currentScenarioName = value; LocationJob.CurrentScenarioName = value; DataEventPublisher.DataListModified(DamProjectData.LocationJobs); DataEventPublisher.AfterChange(this, "CurrentScenarioName"); } } [XmlIgnore] public string CurrentCalculation { get { return currentCalculation; } set { DataEventPublisher.BeforeChange(this, "CurrentCalculation"); currentCalculation = value; LocationJob.CurrentCalculation = value; DataEventPublisher.DataListModified(DamProjectData.LocationJobs); DataEventPublisher.AfterChange(this, "CurrentCalculation"); } } public DamProjectData DamProjectData { get { return damProjectData; } set { damProjectData = value; DataEventPublisher.AfterChange(this, "DamProjectData"); } } private void DataEventPublisher_OnAfterChange(object sender, PublishEventArgs e) { if (sender == damProjectData) { DataEventPublisher.AfterChange(this); } } #region IVisibleEnabled Members public bool IsVisible(string property) { if (damProjectData != null) { switch (property) { case "CurrentProfileName": return false; case "CurrentScenarioName": return false; case "CurrentCalculation": return false; default: return true; } } return true; } public bool IsEnabled(string property) { if (damProjectData != null) { switch (property) { case "CurrentProfileName": return false; case "CurrentScenarioName": return false; case "CurrentCalculation": return false; default: return true; } } return true; } #endregion } }