예제 #1
0
        /// <summary>
        /// Handles the shape connect event.
        /// </summary>
        /// <param name="connection">Created connection.</param>
        private void HandleShapeConnect(Connects connection)
        {
            // connection.FromSheet is always the connector shape.
            // connection.ToSheet is always the shape to which the connector was just connected.

            /*  if (Application.ActivePage != null)
             * {
             *   string shapeName = VisioUtils.GetProperty(connection.FromSheet, "User", VisioUtils.GetShapeType(Application));
             *
             *
             *   if (shapeName == null)
             *       return;
             *
             *   if (shapeName == "Event")
             *   {
             *       if (_eventAttributes != null)
             *           VisioUtils.PaintColoredShape(connection.FromSheet, _eventAttributes.SelectNodes("paint", FormsNamespace.NamespaceManager));
             *   }
             *   else
             *       if (shapeName == "EventProcess")
             *       {
             *           if (_eventProcessAttributes != null)
             *               VisioUtils.PaintColoredShape(connection.FromSheet, _eventProcessAttributes.SelectNodes("paint", FormsNamespace.NamespaceManager));
             *       }
             * }*/
        }
예제 #2
0
 public void CloseConnect(long handle)
 {
     if (Connects.ContainsKey(handle) == false)
     {
         return;
     }
     try
     {
         Connects[handle].Socket.Shutdown(SocketShutdown.Both);
     }
     // throws if client process has already closed
     catch (Exception)
     {
     }
     if (Connects.ContainsKey(handle) == false)
     {
         return;
     }
     Connects[handle].Socket.Close();
     Connects[handle].ClientArgs.Dispose();
     Connects.TryRemove(handle, out Link link);
     OnSocketClose?.Invoke(handle);
     //SocketAsyncEventArgs eventArgs = GetFreeEventArgs();
     //eventArgs.UserToken = Connects[handle];
     //Connects[handle].Socket.DisconnectAsync(eventArgs);
 }
        public int GetProfileSearchTotalRowCount(Connects.Profiles.Service.DataContracts.Profiles pq, out string queryID, out int totalCount)
        {
            string qId = pq.QueryDefinition.QueryID;
            int primeCount = 0;
            int returnedCount = new ProfileServiceAdapter().GetProfileSearchTotalRowCount(qId, primeCount);
            totalCount = returnedCount;

            queryID = qId;

            return returnedCount;
        }
예제 #4
0
        /// <summary>
        /// Handles the shape disconnect event.
        /// </summary>
        /// <param name="connection">Disconnection event.</param>
        private void HandleShapeDisconnect(Connects connection)
        {
            // connection.FromSheet is always the connector shape.
            // connection.ToSheet is always the shape to which the connector was previously connected.

            Shape  connect   = connection.FromSheet;
            string shapeName = VisioUtils.GetProperty(connect, "User", VisioUtils.GetShapeType(Application));

            if (shapeName == null)
            {
                return;
            }

            if (shapeName == "Event" || shapeName == "EventProcess")
            {
                VisioUtils.PaintShape(connection.FromSheet, "2");
            }
        }
예제 #5
0
        //Добавить соединение в поток
        public ProviderConnect AddConnect(string code)
        {
            var con = Connects[code];

            if (!Connects.ContainsKey(code))
            {
                var scon = Project.SchemeConnects[code];
                con = ProvidersFactory.CreateConnect(Logger, scon.Type, scon.Code, scon.Complect, Project.Code);
                con = Connects.Add(code, con);
                if (con.Type == ProviderType.Source)
                {
                    _sources.Add(con.Code, (SourceConnect)con);
                }
                if (con.Type == ProviderType.Receiver)
                {
                    _receivers.Add(con.Code, (ReceiverConnect)con);
                }
                if (!scon.ProviderCode.IsEmpty() && !scon.ProviderInf.IsEmpty())
                {
                    con.JoinProvider(ProvidersFactory.CreateProvider(Logger, scon.ProviderCode, scon.ProviderInf, Project.Code));
                }
            }
            return(con);
        }
예제 #6
0
파일: EventSink.cs 프로젝트: zi-yu/midgard
        /// <summary>
        /// Handles the shape disconnect event.
        /// </summary>
        /// <param name="connection">Disconnection event.</param>
        private void HandleShapeDisconnect(Connects connection)
        {
            // connection.FromSheet is always the connector shape.
            // connection.ToSheet is always the shape to which the connector was previously connected.

            Shape connect = connection.FromSheet;
            string shapeName = VisioUtils.GetProperty(connect, "User", VisioUtils.GetShapeType(Application));

            if (shapeName == null)
                return;

            if (shapeName == "Event" || shapeName == "EventProcess")
                VisioUtils.PaintShape(connection.FromSheet, "2");
        }
예제 #7
0
파일: EventSink.cs 프로젝트: zi-yu/midgard
        /// <summary>
        /// Handles the shape connect event.
        /// </summary>
        /// <param name="connection">Created connection.</param>
        private void HandleShapeConnect(Connects connection)
        {
            // connection.FromSheet is always the connector shape.
            // connection.ToSheet is always the shape to which the connector was just connected.
               /*  if (Application.ActivePage != null)
            {
                string shapeName = VisioUtils.GetProperty(connection.FromSheet, "User", VisioUtils.GetShapeType(Application));

                if (shapeName == null)
                    return;

                if (shapeName == "Event")
                {
                    if (_eventAttributes != null)
                        VisioUtils.PaintColoredShape(connection.FromSheet, _eventAttributes.SelectNodes("paint", FormsNamespace.NamespaceManager));
                }
                else
                    if (shapeName == "EventProcess")
                    {
                        if (_eventProcessAttributes != null)
                            VisioUtils.PaintColoredShape(connection.FromSheet, _eventProcessAttributes.SelectNodes("paint", FormsNamespace.NamespaceManager));
                    }
            }*/
        }
예제 #8
0
        void OnConnectDelete(Connects connects)
        {
            if (SuspendConnectHandlingToMoveAConnectionPoint)
                return;

            foreach (Connect c in connects) {
                // each connection should be between a 1D shape (connector or comment) and a 2D shape (everything else)
                // seems like the fromsheet is always the 1D shape but this should be bulletproof if it changes
                Shape connector = null;
                Shape nonConnector = null;
                if (c.FromSheet.OneD != 0)
                    connector = c.FromSheet;
                else
                    nonConnector = c.FromSheet;

                if (connector == null && c.ToSheet.OneD != 0)
                    connector = c.ToSheet;
                else if (nonConnector == null && c.ToSheet.OneD == 0)
                    nonConnector = c.ToSheet;

                // not sure what it is but we don't care about it
                if (connector == null || nonConnector == null)
                    return;

                Shadow connectorShadow = LookupShadowByShape(connector);
                Shadow nonConnectorShadow = LookupShadowByShape(nonConnector);

                if (connectorShadow == null || nonConnectorShadow == null) {
                    Common.ErrorMessage("Deleting connection from invalid shapes...");
                    return;
                }

                // an ignored shadow (like a comment) can sometimes have links
                // but shouldn't be added as a transition - it's irrelevant
                IgnoredShadow ignored = connectorShadow as IgnoredShadow;
                if (ignored != null)
                    return;

                // determine which end of the connector is connected to the nonConnectorShadow
                bool arrowSide = false;
                if (c.FromCell.Name.Equals(Strings.EndConnectionPointCellName))
                    arrowSide = true;

                if (arrowSide) {
                    connectorShadow.OnConnectDeleteOutput(nonConnectorShadow);
                    nonConnectorShadow.OnConnectDeleteInput(connectorShadow);
                }
                else {
                    connectorShadow.OnConnectDeleteInput(nonConnectorShadow);
                    nonConnectorShadow.OnConnectDeleteOutput(connectorShadow);
                }
            }
            FixHourGlassAfterConfusingVisio();
        }
예제 #9
0
 /// <summary>
 /// The ProfileSearch action provides an XML-based query mechanism for Profiles data.  ProfileSearch takes
 /// an XML request using the Profiles XML schema and returns XML data formatted according to the PersonList XML schema.
 /// </summary>
 /// <param name="Profiles">An XML request using the Profiles XML schema</param>
 /// <returns>Profiles data formatted according to the PersonList XML schema</returns>
 public PersonList ProfileSearch(Connects.Profiles.Service.DataContracts.Profiles pq)
 {
     bool isSecure = System.Convert.ToBoolean(ConfigUtil.GetConfigItem("IsSecure"));
     return new ProfileServiceAdapter().ProfileSearch(pq, isSecure);
 }
예제 #10
0
        void OnConnectAdd(Connects connects)
        {
            if (SuspendConnectHandlingToMoveAConnectionPoint)
            {
                return;
            }

            foreach (Connect c in connects)
            {
                // each connection should be between a 1D shape (connector or comment) and a 2D shape (everything else)
                // The 1D connector is always the To and 2D shapes are always the From
                Shape connector    = null;
                Shape nonConnector = null;
                if (c.FromSheet.OneD != 0)
                {
                    connector = c.FromSheet;
                }
                else
                {
                    nonConnector = c.FromSheet;
                }

                if (connector == null && c.ToSheet.OneD != 0)
                {
                    connector = c.ToSheet;
                }
                else if (nonConnector == null && c.ToSheet.OneD == 0)
                {
                    nonConnector = c.ToSheet;
                }

                // not sure what it is but we don't care about it
                if (connector == null || nonConnector == null)
                {
                    return;
                }

                Shadow connectorShadow    = LookupShadowByShape(connector);
                Shadow nonConnectorShadow = LookupShadowByShape(nonConnector);

                if (connectorShadow == null || nonConnectorShadow == null)
                {
                    Common.ErrorMessage("Adding connector to bogus shapes...");
                    return;
                }

                // an ignored shadow (like a comment) can sometimes have links
                // but shouldn't be added as a transition - it's irrelevant
                IgnoredShadow ignored = connectorShadow as IgnoredShadow;
                if (ignored != null)
                {
                    return;
                }

                // determine which end of the connector is connected to the nonConnectorShadow
                bool arrowSide = false;
                if (c.FromCell.Name.Equals(Strings.EndConnectionPointCellName))
                {
                    arrowSide = true;
                }

                if (arrowSide)
                {
                    connectorShadow.OnConnectAddOutput(nonConnectorShadow);
                    nonConnectorShadow.OnConnectAddInput(connectorShadow);
                }
                else
                {
                    connectorShadow.OnConnectAddInput(nonConnectorShadow);
                    nonConnectorShadow.OnConnectAddOutput(connectorShadow);
                }
            }
        }
        public List<Person> ProfileSearchPersonBinding(Connects.Profiles.Service.DataContracts.Profiles pq, out string queryID, out int totalCount, int startRowIndex, int maximumRows)
        {
            bool isSecure = System.Convert.ToBoolean(ConfigUtil.GetConfigItem("IsSecure"));

            // Modify the search for the start row and max rows
            //((Connects.Profiles.Service.DataContracts.Profiles)pq).OutputOptions.StartRecord = startRowIndex.ToString();

            PersonList personList = new ProfileServiceAdapter().ProfileSearch(pq, isSecure);
            queryID = personList.QueryID;

            totalCount = Convert.ToInt32(personList.TotalCount);
            //complete = personList.Complete;

            int fooCount = new ProfileServiceAdapter().GetProfileSearchTotalRowCount(queryID, totalCount);

            return personList.Person;
        }
예제 #12
0
 /// <summary>
 ///     Add a connect to the module
 /// </summary>
 /// <param name="connect"></param>
 public void Add(Connect connect)
 {
     Connects.Add(connect);
 }
 public PublicationMatchDetailList GetProfilePublicationMatchSummary(Connects.Profiles.Service.DataContracts.Profiles qd)
 {
     return new ProfileServiceAdapter().GetProfilePublicationMatchSummary(qd, false);
 }
        public Connects.Profiles.Service.DataContracts.PersonList ProfileSearch(Connects.Profiles.Service.DataContracts.Profiles qd, bool isSecure)
        {
            Connects.Profiles.Service.DataContracts.PersonList pl = null;
            try
            {
                DataIO ps = new DataIO();
                XmlDocument searchrequest = new XmlDocument();
                Utility.Namespace namespacemgr = new Connects.Profiles.Utility.Namespace();
                XmlNamespaceManager namespaces;

                string responseXML;

                Connects.Profiles.Service.DataContracts.Profiles p = new Connects.Profiles.Service.DataContracts.Profiles();

                string req = Connects.Profiles.Utility.XmlUtilities.SerializeToString(qd);

                Type type = typeof(Connects.Profiles.Service.DataContracts.PersonList);

                searchrequest.LoadXml(this.ConvertToRDFRequest(req));

                namespaces = namespacemgr.LoadNamespaces(searchrequest);

                if (qd.QueryDefinition.PersonID!=null)
                {
                    responseXML = ps.Search(qd.QueryDefinition.PersonID).OuterXml;
                }
                else
                {
                    responseXML = ps.Search(searchrequest,isSecure).OuterXml;
                }

                string queryid = string.Empty;
                string version = string.Empty;
                bool individual = false;

                queryid = qd.QueryDefinition.QueryID;
                version = qd.Version.ToString();

                if (qd.QueryDefinition.PersonID != null)
                    individual = true;

                responseXML = ps.ConvertV2ToBetaSearch(responseXML, queryid, version, individual);

                pl = Connects.Profiles.Utility.XmlUtilities.DeserializeObject(responseXML, type) as Connects.Profiles.Service.DataContracts.PersonList;

            }
            catch (Exception ex)
            {
                DebugLogging.Log("ERROR==> " + ex.Message + " STACK:" + ex.StackTrace + " SOURCE:" + ex.Source);
            }

            return pl;
        }
        public Connects.Profiles.Service.DataContracts.PublicationMatchDetailList GetProfilePublicationMatchSummary(Connects.Profiles.Service.DataContracts.Profiles qd, bool isSecure)
        {
            qd.Version = 2;

            Connects.Profiles.Service.DataContracts.PersonList pl = ProfileSearch(qd, isSecure);
            Connects.Profiles.Service.DataContracts.PublicationMatchDetailList pubMatch = new Connects.Profiles.Service.DataContracts.PublicationMatchDetailList();
            HashSet<string> searchPhraseDistinct = new HashSet<string>();
            HashSet<string> publicationPhraseDistinct = new HashSet<string>();

            if (pl != null)
            {

                foreach (Connects.Profiles.Service.DataContracts.Publication pub in pl.Person[0].PublicationList)
                {

                    foreach (Connects.Profiles.Service.DataContracts.PublicationMatchDetail pubMatchDetail in pub.PublicationMatchDetailList)
                    {
                        Connects.Profiles.Service.DataContracts.PublicationMatchDetail pubMatchDetailStripped = new Connects.Profiles.Service.DataContracts.PublicationMatchDetail();
                        pubMatchDetailStripped.SearchPhrase = pubMatchDetail.SearchPhrase;

                        if (!searchPhraseDistinct.Contains(pubMatchDetail.SearchPhrase))
                        {
                            pubMatch.Add(pubMatchDetailStripped);

                            searchPhraseDistinct.Add(pubMatchDetail.SearchPhrase);
                        }

                        foreach (Connects.Profiles.Service.DataContracts.PublicationPhraseDetail pubPhraseDetail in pubMatchDetail.PublicationPhraseDetailList)
                        {

                            //PublicationPhraseDetail pubPhraseDetailStripped = new PublicationPhraseDetail();
                            //pubPhraseDetailStripped.PublicationPhrase = pubPhraseDetail.PublicationPhrase;

                            //PublicationMatchDetail pmd = pubMatch.Find(delegate(PublicationMatchDetail t) { return t.SearchPhrase == pubMatchDetail.SearchPhrase; });

                            //// Handle the structure
                            //if (!publicationPhraseDistinct.Contains(pubPhraseDetail.PublicationPhrase))
                            //{
                            //    if (pmd.PublicationPhraseDetailList == null)
                            //        pmd.PublicationPhraseDetailList = new PublicationPhraseDetailList();

                            //    pmd.PublicationPhraseDetailList.Add(pubPhraseDetailStripped);

                            //    publicationPhraseDistinct.Add(pubPhraseDetail.PublicationPhrase);
                            //}

                            //// Get the Phrase Measurements
                            //PublicationPhraseDetail ppd = pmd.PublicationPhraseDetailList.Find(delegate(PublicationPhraseDetail t) { return t.PublicationPhrase == pubPhraseDetail.PublicationPhrase; });
                            //ppd.PhraseMeasurements = pubPhraseDetail.PhraseMeasurements;

                            //if (ppd.PublicationList == null)
                            //    ppd.PublicationList = new PublicationList();
                            //ppd.PublicationList.Add(pub);
                            Connects.Profiles.Service.DataContracts.PublicationMatchDetail pmd = pubMatch.Find(delegate(Connects.Profiles.Service.DataContracts.PublicationMatchDetail t) { return t.SearchPhrase == pubMatchDetail.SearchPhrase; });

                            if (pmd.PublicationPhraseDetailList == null)
                                pmd.PublicationPhraseDetailList = new Connects.Profiles.Service.DataContracts.PublicationPhraseDetailList();

                            pubPhraseDetail.Publication = pub;
                            pmd.PublicationPhraseDetailList.Add(pubPhraseDetail);
                        }

                    }

                }

            }

            // IEnumerable<PublicationMatchDetail> noduplicates = pubMatch.Distinct();

            return pubMatch;
        }
예제 #16
0
        /// <summary>
        /// Event handler for subscribed events.
        /// </summary>
        /// <param name="eventCode">Code of the captured event.</param>
        /// <param name="source">Source object. In this case, it will always be the Visio application.</param>
        /// <param name="eventID">?</param>
        /// <param name="eventSequenceNumber">?</param>
        /// <param name="subject">The object which caused the event. This parameter is not set for marker events (which are raised by Visio).</param>
        /// <param name="moreInfo">?</param>
        /// <returns>Always null.</returns>
        public object VisEventProc(short eventCode, object source, int eventID, int eventSequenceNumber, object subject, object moreInfo)
        {
            VisioApplication visioApplication = null;

            try
            {
                visioApplication = (VisioApplication)source;

                if (_active == false)
                {
                    return(null);
                }

                if (visioApplication.IsUndoingOrRedoing == true)
                {
                    return(null);
                }

                /*
                 * Test eventCode.
                 * Yes, it's _so_ retarded to have to use if/else, but we can't switch
                 * since VisioEvent.* aren't constants. :/
                 */


                /*
                 * Called whenever one shape connects to another. Filter out
                 * connects which are not raised by QuartzProcess shapes.
                 */
                #region Shape Connect

                if (eventCode == VisioEvent.ShapeConnect)
                {
                    Connects connects = (Connects)subject;
                    HandleShapeConnect(connects);
                }

                #endregion


                /*
                 * Called whenever a shape is disconnected from another. Filter
                 * out disconnects which are not raised by QuartzProcess shapes.
                 */
                #region Shape Disconnect

                else if (eventCode == VisioEvent.ShapeDisconnect)
                {
                    Connects connects = (Connects)subject;
                    HandleShapeDisconnect(connects);
                }

                #endregion


                /*
                 * Called whenever a QueueMarkerEvent command is executed from
                 * the shape. Filter out events which are not raised by
                 * QuartzProcess app.
                 */
                #region Marker Events

                else if (eventCode == VisioEvent.ShapeEventMarker)
                {
                    string context = visioApplication.get_EventInfo(VisioEvent.IdMostRecent);

                    if (context == null)
                    {
                        return(null);
                    }

                    NameValueCollection nvc = VisioUtils.ParseContext(context);

                    HandleMarkerEvent(nvc);
                }

                #endregion
            }
            catch (Exception ex)
            {
                ESIMessageBox.ShowError(ex);
            }

            return(null);
        }
        public Connects.Profiles.Service.DataContracts.PersonList ProfileSearch(Connects.Profiles.Service.DataContracts.Profiles qd, bool isSecure)
        {
            Connects.Profiles.Service.DataContracts.PersonList pl = null;
            string req = string.Empty;
            string responseXML = string.Empty;

            try
            {
                DataIO ps = new DataIO();
                XmlDocument searchrequest = new XmlDocument();
                Utility.Namespace namespacemgr = new Connects.Profiles.Utility.Namespace();

                Connects.Profiles.Service.DataContracts.Profiles p = new Connects.Profiles.Service.DataContracts.Profiles();

                req = Connects.Profiles.Utility.XmlUtilities.SerializeToString(qd);

                DebugLogging.Log("+++++++++ REQUEST=" + req);

                Type type = typeof(Connects.Profiles.Service.DataContracts.PersonList);

                searchrequest.LoadXml(this.ConvertToRDFRequest(req, qd.Version.ToString()));

                if (qd.QueryDefinition.PersonID != null && qd.Version != 2)
                {
                    qd.QueryDefinition.PersonID = ps.GetPersonID(qd.QueryDefinition.PersonID).ToString();
                }

                if (qd.QueryDefinition.PersonID != null)
                {
                    responseXML = ps.Search(qd.QueryDefinition.PersonID, isSecure).OuterXml;
                }
                else
                {
                    responseXML = ps.Search(searchrequest, isSecure).OuterXml;
                }

                string queryid = string.Empty;
                queryid = qd.QueryDefinition.QueryID;

                if (responseXML == string.Empty)
                {
                    if (queryid == null)
                        queryid = Guid.NewGuid().ToString();

                    responseXML = "<PersonList Complete=\"true\" ThisCount=\"0\" TotalCount=\"0\" QueryID=\"" + queryid + "\" xmlns=\"http://connects.profiles.schema/profiles/personlist\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" />";

                }
                else
                {

                    string version = string.Empty;
                    bool individual = false;

                    version = qd.Version.ToString();

                    if (qd.QueryDefinition.PersonID != null || qd.QueryDefinition.InternalIDList != null)
                        individual = true;

                    responseXML = ps.ConvertV2ToBetaSearch(responseXML, queryid, version, individual);
                }

                DebugLogging.Log("+++++++++ DONE WITH Convert V2 to Beta Search");
                pl = Connects.Profiles.Utility.XmlUtilities.DeserializeObject(responseXML, type) as Connects.Profiles.Service.DataContracts.PersonList;
                DebugLogging.Log("+++++++++ Returned + a total count of = " + pl.TotalCount);

            }
            catch (Exception ex)
            {
                DebugLogging.Log(req + " " + responseXML);
                DebugLogging.Log("ERROR==> " + ex.Message + " STACK:" + ex.StackTrace + " SOURCE:" + ex.Source);
            }

            return pl;
        }