Ejemplo n.º 1
0
        public void HandleIncomingLink(FwLink link)
        {
            CheckDisposed();

            FwXWindow fwxwnd = null;
            string    server = link.Server.Replace(".", Environment.MachineName);

            // = FwLink.RestoreServerFromURL(link.Server).Replace(".", Environment.MachineName);
            Debug.Assert(server != null && server != String.Empty);
            string database = link.Database;

            Debug.Assert(database != null && database != String.Empty);
            string key = MakeKey(server, database);

            if (!m_caches.ContainsKey(key))
            {
                // Add command line info.
                Dictionary <string, List <String> > oldTable = m_commandLineArgs;              // Save original args.
                m_commandLineArgs = new Dictionary <string, List <String> >();
                List <String> list = new List <String>();
                list.Add(server);
                m_commandLineArgs.Add("c", list);
                list = new List <String>();
                list.Add(database);
                m_commandLineArgs.Add("db", list);
                list = new List <String>();
                list.Add(link.ToString());
                m_commandLineArgs.Add("link", list);
                Form frm = ActiveForm;
                fwxwnd = (FwXWindow)NewMainWindow(null, false);
                AdjustNewWindowPosition(fwxwnd, frm);
                m_commandLineArgs = oldTable;                 // Restore oringinal args.
            }
            else
            {
                FdoCache cache = m_caches[key];
                // Get window that uses the given DB.
                foreach (FwXWindow wnd in m_rgMainWindows)
                {
                    if (wnd.Cache == cache)
                    {
                        fwxwnd = wnd;
                        break;
                    }
                }
            }
            fwxwnd.Mediator.SendMessage("FollowLink", link);
            bool topmost = fwxwnd.TopMost;

            fwxwnd.TopMost = true;
            fwxwnd.TopMost = topmost;
            fwxwnd.Activate();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// This is the one (and should be only) handler for the user Refresh command.
        /// Refresh wants to first clean up the cache, then give things like Clerks a
        /// chance to reload stuff (calling the old OnRefresh methods), then give
        /// windows a chance to redisplay themselves.
        /// </summary>
        public void OnMasterRefresh(object sender)
        {
            CheckDisposed();
            // Susanna asked that refresh affect only the currently active project, which is
            // what the string and List variables below attempt to handle.  See LT-6444.
            string    sDatabase = null;
            string    sServer   = null;
            FwXWindow activeWnd = ActiveForm as FwXWindow;

            if (activeWnd != null)
            {
                sDatabase = activeWnd.Cache.DatabaseName.ToLowerInvariant();
                sServer   = activeWnd.Cache.ServerName.ToLowerInvariant();
            }
            List <FwXWindow> rgxw = new List <FwXWindow>();

            foreach (IFwMainWnd wnd in MainWindows)
            {
                FwXWindow xwnd = wnd as FwXWindow;
                if (xwnd != null)
                {
                    if (sDatabase == null ||
                        (xwnd.Cache.DatabaseName.ToLowerInvariant() == sDatabase &&
                         xwnd.Cache.ServerName.ToLowerInvariant() == sServer))
                    {
                        xwnd.PrepareToRefresh();
                        rgxw.Add(xwnd);
                    }
                }
            }
            FwApp.App.ClearAllCaches(sDatabase, sServer);
            foreach (FwXWindow xwnd in rgxw)
            {
                if (activeWnd != xwnd)
                {
                    xwnd.FinishRefresh();
                }
            }

            // LT-3963: active window changes as a result of a refresh.
            // Make sure focus doesn't switch to another FLEx application / window also
            // make sure the application focus isn't lost all together.
            // ALSO, after doing a refresh with just a single application / window,
            // the application would loose focus and you'd have to click into it to
            // get that back, this will reset that too.
            if (activeWnd != null)
            {
                // Refresh it last, so its saved settings get restored.
                activeWnd.FinishRefresh();
                activeWnd.Activate();
            }
        }
Ejemplo n.º 3
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Handles the incoming link, after the right window of the right application on the right
        /// project has been activated.
        /// See the class comment on FwLinkArgs for details on how all the parts of hyperlinking work.
        /// </summary>
        /// <param name="link">The link.</param>
        /// ------------------------------------------------------------------------------------
        public override void HandleIncomingLink(FwLinkArgs link)
        {
            CheckDisposed();

            // Get window that uses the given DB.
            FwXWindow fwxwnd = m_rgMainWindows.Count > 0 ? (FwXWindow)m_rgMainWindows[0] : null;

            if (fwxwnd != null)
            {
                fwxwnd.Mediator.SendMessage("FollowLink", link);
                bool topmost = fwxwnd.TopMost;
                fwxwnd.TopMost = true;
                fwxwnd.TopMost = topmost;
                fwxwnd.Activate();
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// This is the one (and should be only) handler for the user Refresh command.
        /// Refresh wants to first clean up the cache, then give things like Clerks a
        /// chance to reload stuff (calling the old OnRefresh methods), then give
        /// windows a chance to redisplay themselves.
        /// </summary>
        public void OnMasterRefresh(object sender)
        {
            // TODO: This is no longer called by the Mediator, since this class
            // is no longer an xcore colleague. But, it can't be removed either,
            // since it is used by another method on this clsss. :-(
            CheckDisposed();

            // Susanna asked that refresh affect only the currently active project, which is
            // what the string and List variables below attempt to handle.  See LT-6444.
            FwXWindow activeWnd = ActiveForm as FwXWindow;

            List <FwXWindow> rgxw = new List <FwXWindow>();

            foreach (IFwMainWnd wnd in MainWindows)
            {
                FwXWindow xwnd = wnd as FwXWindow;
                if (xwnd != null)
                {
                    xwnd.PrepareToRefresh();
                    rgxw.Add(xwnd);
                }
            }
            if (activeWnd != null)
            {
                rgxw.Remove(activeWnd);
            }

            foreach (FwXWindow xwnd in rgxw)
            {
                xwnd.FinishRefresh();
                xwnd.Refresh();
            }

            // LT-3963: active window changes as a result of a refresh.
            // Make sure focus doesn't switch to another FLEx application / window also
            // make sure the application focus isn't lost all together.
            // ALSO, after doing a refresh with just a single application / window,
            // the application would loose focus and you'd have to click into it to
            // get that back, this will reset that too.
            if (activeWnd != null)
            {
                // Refresh it last, so its saved settings get restored.
                activeWnd.FinishRefresh();
                activeWnd.Refresh();
                activeWnd.Activate();
            }
        }