예제 #1
0
        /// <summary>
        ///     Called when [entity browser message received].
        /// </summary>
        /// <param name="message">The message.</param>
        protected void OnEntityBrowserMessageReceived(EntityBrowserMessage message)
        {
            var evt = OnEntityBrowserMessage;

            if (evt != null)
            {
                evt(this, message);
            }
        }
예제 #2
0
        /// <summary>
        ///     Channel the on entity browser message.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        private void Channel_OnEntityBrowserMessage(object sender, EntityBrowserMessage e)
        {
            string message = e.ToString( );

            PropagateMessageToPlugins(message);
        }
예제 #3
0
        /// <summary>
        ///     Shows the balloon.
        /// </summary>
        /// <param name="entityMessage">The entity message.</param>
        /// <returns></returns>
        private bool ShowBalloon(EntityBrowserMessage entityMessage)
        {
            lock ( _syncRoot )
            {
                var entityBrowserViewModel = _userInterface.DataContext as EntityBrowserViewModel;

                if (entityBrowserViewModel != null)
                {
                    long   id;
                    long   tenantId;
                    Guid   upgradeId;
                    string name;
                    string description;
                    string tenant;
                    string solution;
                    string type;

                    if (entityBrowserViewModel.GetEntityDetails(entityMessage.Entity, out id, out tenantId, out upgradeId, out name, out description, out tenant, out solution, out type))
                    {
                        if (FancyBalloon.CurrentEntityId == id)
                        {
                            return(true);
                        }

                        FancyBalloon fancyBalloon = null;

                        if (_notifyIcon.CustomBalloon != null && _notifyIcon.CustomBalloon.Child != null)
                        {
                            fancyBalloon = _notifyIcon.CustomBalloon.Child as FancyBalloon;
                        }

                        FancyBalloon.CurrentEntityId = id;

                        var viewModel = new FancyBalloonViewModel
                        {
                            BalloonTitle = "ReadiMon Entity detected...",
                            EntityId     = id.ToString(CultureInfo.InvariantCulture),
                            TenantId     = entityBrowserViewModel.GetTenantName(tenantId),
                            UpgradeId    = upgradeId.ToString("B"),
                            Name         = name,
                            Description  = description,
                            Tenant       = tenant,
                            Solution     = solution,
                            Type         = type
                        };

                        viewModel.ShowEntity += viewModel_ShowEntity;

                        if (fancyBalloon != null)
                        {
                            NextViewModel = viewModel;

                            fancyBalloon.Closed += fancyBalloon_Closed;

                            _notifyIcon.CloseBalloon( );

                            return(true);
                        }

                        var balloon = new FancyBalloon
                        {
                            DataContext = viewModel,
                            EventLog    = Settings.EventLog
                        };

                        _notifyIcon.ShowCustomBalloon(balloon, PopupAnimation.Scroll, _balloonTimeout);

                        return(true);
                    }
                }
            }

            return(false);
        }