Example #1
0
        public void CollectionManager_Changed_ChangeUntypedObject()
        {
            var remoteMethodCall = new Mock<IDdpRemoteMethodCall>();

            var collectionManager = new CollectionManager(remoteMethodCall.Object);

            var objectToAdd = new TestDdpObject { integerField = 101, StringProperty = "addedTest"};

            collectionManager.Added(new Added { Collection = "Test", Fields = JObject.FromObject(objectToAdd), Id = "1" });

            var changed = new Changed
            {
                Cleared = null,
                Collection = "Test",
                Fields = new Dictionary<string, JToken>() {{"StringProperty", JToken.FromObject("changed!")}},
                ID = "1"
            };

            collectionManager.Changed(changed);

            var collection = collectionManager.GetCollection<TestDdpObject>("Test");

            Assert.AreEqual(1, collection.Count);

            objectToAdd.StringProperty = "changed!";
            objectToAdd.Id = "1";
            AssertDdpObjectsEqual(objectToAdd, collection.First());
        }
Example #2
0
        public void ChangedHandler_HandleMessage_DeserializsAndCallsCollectionManager()
        {
            var connectionMock = new Mock<IDdpConnectionSender>();
            var collectionMock = new Mock<ICollectionManager>();
            var resultHandlerMock = new Mock<IResultHandler>();

            var testObject = new SimpleDdpObject { IsTrue = false };
            var added = new Changed { Collection = "Tests", Fields = null, ID = "1" };

            var handler = new ChangedHandler();

            handler.HandleMessage(connectionMock.Object, collectionMock.Object, resultHandlerMock.Object,
                JsonConvert.SerializeObject(added));

            collectionMock.Verify(collection => collection.Changed(It.IsAny<Changed>()), Times.Once());
        }
Example #3
0
        public bool AddChangedToGoods(Goods g, Changed c)
        {
            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    g.ChangedSet.Add(c);
                    g.Quantity = g.Quantity + c.Value;
                    this.ObjectContext.SaveChanges(SaveOptions.None);

                    scope.Complete();
                    this.ObjectContext.AcceptAllChanges();
                    return true;
                }
            }
            catch
            {

            }
            return false;
        }
Example #4
0
 protected void OnChanged() => Changed?.Invoke(this, EventArgs.Empty);
 //Methods that checks if there are subscribers to an event, if there is, the event is raised
 protected virtual void OnChanged(object sender, ListChangedEventArgs <T> args)
 {
     Changed?.Invoke(this, args);
 }
Example #6
0
 public void NotifySinceSubobjectChanged() => Changed?.Invoke();
 private void OnChildChanged(object sender, EventArgs e)
 {
     Changed.Raise(this);
 }
Example #8
0
 public void TriggerScriptChangedEvent(Changed val)
 {
     if (ParentGroup != null && ParentGroup.Scene != null)
         ParentGroup.Scene.EventManager.TriggerOnScriptChangedEvent(LocalId, (uint)val);
 }
 public void TriggerScriptChangedEvent(Changed val)
 {
     SceneObjectPart[] parts = m_parts.GetArray();
     for (int i = 0; i < parts.Length; i++)
         parts[i].TriggerScriptChangedEvent(val);
 }
Example #10
0
 public void Reset()
 {
     SwitchEvaluator  = null;
     PublishToAzure30 = null;
     Changed?.Invoke(this, EventArgs.Empty);
 }
Example #11
0
 public void Save()
 {
     _service.SaveString(SuppressDialog.SwitchEvaluatorSetting, SuppressDialog.Category, SwitchEvaluator);
     _service.SaveString(SuppressDialog.PublishToAzure30Setting, SuppressDialog.Category, PublishToAzure30);
     Changed?.Invoke(this, EventArgs.Empty);
 }
Example #12
0
 public void Load()
 {
     SwitchEvaluator  = _service.LoadString(SuppressDialog.SwitchEvaluatorSetting, SuppressDialog.Category);
     PublishToAzure30 = _service.LoadString(SuppressDialog.PublishToAzure30Setting, SuppressDialog.Category);
     Changed?.Invoke(this, EventArgs.Empty);
 }
Example #13
0
 /// <summary>
 /// Must be called to rebuild the theme.
 /// </summary>
 public void ThemeHasChanged()
 {
     Changed?.Invoke(this, EventArgs.Empty);
 }
 void OnDataSource_Changed(object sender, EventArgs e)
 {
     Update();
     Changed.Raise(this);
 }
 private void nudHeight_ValueChanged(object sender, EventArgs e)
 {
     Changed?.Invoke();
 }
Example #16
0
 // private helpers
 private void invokeChanged()
 {
     Changed?.Invoke(this, EventArgs.Empty);
 }
Example #17
0
 /// <summary>
 /// MyGrid_Changed causes the grid to be redrawn by raising a changed event
 /// </summary>
 /// <param name="sender">the object that caused the change</param>
 /// <param name="e">what needs to be redrawn</param>
 private void MyGrid_Changed(object sender, EventArgs e)
 {
     Changed?.Invoke(this, e);
 }
        public PresentationDesignerForm(PresentationInfo aPresentationInfo)
        {
            m_PresentationInfo = aPresentationInfo;
            m_Presentation = aPresentationInfo.CreatePresentationStub();
            PresentationController.CreatePresentationController();
            PresentationController.Instance.PresentationChanged = false;
            PresentationChanged = new Changed(() =>
            {
                this.saveMenuButton.Enabled = PresentationController.Instance.PresentationChanged;
                this.savePresentationToolButton.Enabled = PresentationController.Instance.PresentationChanged;
                this.ChangedStatus.Visible = PresentationController.Instance.PresentationChanged;
                this.ChangedStatus.Text = PresentationController.Instance.ChangedTextStatus;
            });
            PresentationController.Instance.OnChanged += PresentationChanged;
            PresentationController.Instance.OnPresentationLockChanged += new PresentationLockChanged(Instance_OnPresentationLockChanged);
            PresentationController.Instance.OnPresentationRemoved += new Changed(Instance_OnPresentationRemoved);
            PresentationController.Instance.OnPresentationLockedExternally += new PresentationLockedExternally(Instance_OnPresentationLockedExternally);
            PresentationController.Instance.OnPresentationUnlockedExternally += new PresentationUnlockedExternally(Instance_OnPresentationUnlockedExternally);
            PresentationController.Instance.OnSlideSelectionChanged += new SlideSelectionChanged(Instance_OnSlideSelectionChanged);
            PresentationController.Instance.OnOtherUserLockForShow += new SlideChanged(Instance_OnOtherUserLockForShow);
            UndoService.CreateUndoService();
            PresentationController.Instance.AssignPresentation(m_Presentation, m_PresentationInfo);
            InitializeComponent();

            RefreshTitle();
            this.statusStrip.ContextMenuStrip = null;
            this.ChangedStatus.Visible = false;

            this.WindowState = FormWindowState.Maximized;
            UndoService.Instance.OnHistoryChanged += new HistoryChanged(OnHistoryChanged);

            identity = Thread.CurrentPrincipal as UserIdentity;
            slideDiagram.SwitchPlayerMode(false);

            toolStripEx2.Enabled = false;
            PresentationController.Instance.RefreshLockingInfo();


            LockingInfo li = ((PresentationInfoExt)m_PresentationInfo).LockingInfo;
            if (li != null)
            {
                string info = String.Format(lockedByUser, 
                    string.IsNullOrEmpty(li.UserIdentity.User.FullName) ? li.UserIdentity.User.Name : li.UserIdentity.User.FullName,
                    li.RequireLock == RequireLock.ForShow ? "для показа" :  "для редактирования");
                this.LockingStatus.Visible = true;
                this.LockingStatus.Text = info;
                if (li.RequireLock == RequireLock.ForShow)
                {
                    layoutPreviewMenuButton.Enabled = false;
                    previewToolButton.Enabled = false;
                }
            }

            if (layoutPreviewMenuButton.Enabled || previewToolButton.Enabled)
            {
                layoutPreviewMenuButton.Enabled = previewToolButton.Enabled = !LayoutController.Instance.IsShownByPlayer();
            }

            SlideGraphController.Instance.OnSlideHover += new EventHandler<SlideEventArgs>(Instance_OnSlideHover);

            updateMenuButton.Enabled = !DesignerClient.Instance.IsStandAlone;
            refreshDisplayMenuButton.Enabled = !DesignerClient.Instance.IsStandAlone;
            refreshSlidesMenuButton.Enabled = !DesignerClient.Instance.IsStandAlone;
            commonSourcesRefreshMenuButton.Enabled = !DesignerClient.Instance.IsStandAlone;
            equipmentRefreshMenuButton.Enabled = !DesignerClient.Instance.IsStandAlone;
            toXmlMenuButton.Enabled = !DesignerClient.Instance.IsStandAlone;

            LayoutController.Instance.OnShownStatusChanged += new Action<bool>(Instance_OnShownStatusChanged);
            layoutPreviewMenuButton.Visible = previewToolButton.Visible = !DesignerClient.Instance.IsStandAlone;
        }
Example #19
0
 private void HandleUserCacheUpdatedEvent(CacheUpdateEvent cacheUpdateEvent)
 {
     Changed?.Invoke(cacheUpdateEvent);
 }
Example #20
0
 public void TriggerScriptChangedEvent(Changed val)
 {
     if (m_parentGroup != null && m_parentGroup.Scene != null)
         m_parentGroup.Scene.EventManager.TriggerOnScriptChangedEvent(this, (uint)val);
 }
Example #21
0
 public void Clear()
 {
     s_undo.Clear();
     s_redo.Clear();
     Changed.Invoke(this, EventArgs.Empty);
 }
Example #22
0
 private void OnChanged()
 {
     Changed?.Invoke();
 }
Example #23
0
 /// <summary>
 /// Handler for on changed events.
 /// </summary>
 /// <param name="resources">A collection of resources to pass to the event handler.</param>
 protected virtual void OnChanged(Resource[] resources)
 {
     Changed?.Invoke(this, resources);
 }
Example #24
0
 protected virtual void OnChanged(EventArgs e)
 {
     Changed?.Invoke(this, e);
 }
Example #25
0
        private void ProjectSnapshotManager_Changed(object sender, ProjectChangeEventArgs args)
        {
            var convertedArgs = new OmniSharpProjectChangeEventArgs(args);

            Changed?.Invoke(this, convertedArgs);
        }
Example #26
0
        private void OnChanged()
        {
            var args = new EditorSettingsChangedEventArgs(Current);

            Changed?.Invoke(this, args);
        }
 public void OnChanged(BindingChangedEventArgs e)
 {
     Changed?.Invoke(target, e);
 }
 /// <summary>
 /// Inform the resource management, that this instance was modified
 /// and trigger saving the current state to storage
 /// </summary>
 protected void RaiseResourceChanged()
 {
     // This is only null during boot, when the resource manager populates the object
     Changed?.Invoke(this, EventArgs.Empty);
 }
Example #29
0
 private static void OnStateChanged(Changed <RoomPlayer> changed)
 {
     PlayerChanged?.Invoke(changed.Behaviour);
 }
Example #30
0
        public bool UpdateingGoodsWithChanged(Goods g, Changed c)
        {
            try
            {
                using (TransactionScope scope = new TransactionScope())
                {

                    c.Value = c.GoodsItemSet.Sum(x => x.Quantity);
                    c.SumCost = c.GoodsItemSet.Sum(p => (decimal)p.Quantity * c.PieceCost);
                    this.ObjectContext.SaveChanges();

                    g.Quantity = g.Quantity + c.Value;
                    this.ObjectContext.SaveChanges();

                    scope.Complete();
                    this.ObjectContext.AcceptAllChanges();
                    return true;
                }
            }
            catch
            {

            }
            return false;
        }
Example #31
0
 private void HandleUserCacheUpdatedEvent(CacheUpdateEvent cacheUpdateEvent)
 {
     //Logger.Trace("GitUserCache Updated {0}", cacheUpdateEvent.UpdatedTime);
     Changed?.Invoke(cacheUpdateEvent);
 }
Example #32
0
        public void CollectionManager_Changed_NotExist()
        {
            var collectionManager = new CollectionManager(null);

            var changed = new Changed
            {
                Cleared = null,
                Collection = "Test",
                Fields = new Dictionary<string, JToken>() { { "StringProperty", JToken.FromObject("changed!") } },
                ID = "1"
            };

            ExceptionAssert.Throws<InvalidOperationException>(() => collectionManager.Changed(changed));
        }
 protected void RaiseChanged()
 {
     Changed.Raise(this);
 }
Example #34
0
 public void TriggerScriptChangedEvent(Changed val)
 {
     m_childParts.ForEachPart((SceneObjectPart part) => {
         part.TriggerScriptChangedEvent(val);
     });
 }
Example #35
0
 internal void NotifyChanged()
 {
     Runtime.AssertMainThread();
     Changed?.Invoke(this, EventArgs.Empty);
     ParentCommandInfo?.NotifyChanged();
 }
Example #36
0
        public void TriggerScriptChangedEvent(Changed val)
        {
            SceneObjectPart[] parts = this.GetParts();

            foreach (SceneObjectPart part in parts)
                part.TriggerScriptChangedEvent(val);
        }
Example #37
0
 private void RaiseChanged()
 {
     Changed?.Invoke(this);
     Workspace.RaiseChanged();
 }
Example #38
0
 public void TriggerScriptChangedEvent(Changed val)
 {
     if (m_parentGroup != null && m_parentGroup.Scene != null)
     {
         m_parentGroup.Scene.EventManager.TriggerOnScriptChangedEvent(LocalId, (uint)val);
     }
     /*else
     {
         m_log.ErrorFormat("[SCENE]: Not triggering script changed event for '{0}' because {1}", this.Name, m_parentGroup == null ? "Group is null" : "Scene is null");
     }
     */
 }
Example #39
0
 internal void NotifyChanged()
 {
     Changed?.Invoke(this, EventArgs.Empty);
 }
 private void SendScriptEventToAllAttachments(Changed c)
 {
     IAttachmentsModule attMod = Scene.RequestModuleInterface<IAttachmentsModule>();
     if (attMod != null)
         attMod.SendScriptEventToAttachments(UUID, "changed", new Object[] {c});
 }
Example #41
0
 /// <summary>
 /// Invoke the Changed event.
 /// </summary>
 public void InvokeChanged() => Changed?.Invoke(this, EventArgs.Empty);
Example #42
0
 public static void Show(MadAtlas atlas, string currentGUID, Changed changedCallback, ScriptableObject parent) {
     //var window = ScriptableObject.CreateInstance<MadAtlasBrowser>();
     var browser = EditorWindow.GetWindow<MadAtlasBrowser>(true, "Atlas Browser", true);
     browser.atlas = atlas;
     browser.changedCallback = changedCallback;
     browser.selectedItemGUID = currentGUID;
     browser.parent = parent;
 }
Example #43
0
 protected virtual void OnChanged()
 {
     Changed?.Invoke(this, EventArgs.Empty);
 }
 public void TriggerScriptChangedEvent(Changed val)
 {
     foreach (SceneObjectPart part in ChildrenList)
     {
         part.TriggerScriptChangedEvent(val);
     }
 }
Example #45
0
 protected void OnChanged(SettingsChangedEventArgs args)
 {
     Changed?.Invoke(this, args);
 }