public SmartScriptBase(ISmartFactory smartFactory,
                               ISmartDataManager smartDataManager,
                               IMessageBoxService messageBoxService)
        {
            this.smartFactory      = smartFactory;
            this.smartDataManager  = smartDataManager;
            this.messageBoxService = messageBoxService;
            Events          = new ObservableCollection <SmartEvent>();
            selectionHelper = new SmartSelectionHelper(this);
            selectionHelper.ScriptSelectedChanged += CallScriptSelectedChanged;
            selectionHelper.EventChanged          += (e, a, mask) =>
            {
                RenumerateEvents();
                EventChanged?.Invoke(e, a, mask);
            };
            AllSmartObjectsFlat = selectionHelper.AllSmartObjectsFlat;
            AllActions          = selectionHelper.AllActions;

            Events.ToStream()
            .Subscribe((e) =>
            {
                if (e.Type == CollectionEventType.Add)
                {
                    e.Item.Parent = this;
                }
            });
        }
Esempio n. 2
0
        public SmartScript(ISmartScriptSolutionItem item,
                           ISmartFactory smartFactory,
                           ISmartDataManager smartDataManager,
                           IMessageBoxService messageBoxService)
        {
            this.smartFactory      = smartFactory;
            this.smartDataManager  = smartDataManager;
            this.messageBoxService = messageBoxService;
            EntryOrGuid            = (int)item.Entry;
            SourceType             = item.SmartType;
            Events          = new ObservableCollection <SmartEvent>();
            selectionHelper = new SmartSelectionHelper(this);
            selectionHelper.ScriptSelectedChanged += CallScriptSelectedChanged;
            AllSmartObjectsFlat = selectionHelper.AllSmartObjectsFlat;

            Events.ToStream()
            .Subscribe((e) =>
            {
                if (e.Type == CollectionEventType.Add)
                {
                    e.Item.Parent = this;
                }
            });
        }