Example #1
0
        /// <summary>
        ///     Creates a new connection by spawning a new thread.
        /// </summary>
        /// <param name="favorite"> </param>
        /// <param name="TerminalTabPage"> </param>
        /// <param name="parentForm"> </param>
        /// <remarks>
        ///     This method calls the <see cref="ConnectionBase.Connect" /> method and requires it to be thread safe.
        /// </remarks>
        public static void CreateConnection(FavoriteConfigurationElement favorite, IHostingForm parentForm, bool waitforEnd, TerminalTabControlItem terminalTabPage, ConnectionBase conn = null)
        {
            // This might happen if the user is not allowed to
            // use all available connections e.g.
            // if the user has a freeware version.
            if (Limit.Contains(favorite.Protocol.ToUpper()) || terminalTabPage == null)
            {
                MessageBox.Show("You are not allowed to use that kind of connection!", AssemblyInfo.Title, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (!waitforEnd)
            {
                Thread t = new Thread((ThreadStart) delegate
                {
                    Code(terminalTabPage, parentForm, favorite, conn);
                });

                t.SetApartmentState(ApartmentState.STA);
                t.Start();
            }
            else
            {
                Code(terminalTabPage, parentForm, favorite, conn);
            }
        }
Example #2
0
        protected override bool OnButtonPressEvent(Gdk.EventButton args)
        {
            if (args.Button == 3)
            {
                return(DrawOrderMenu(args));
            }

            double x = args.X + action.X;
            double y = args.Y + action.Y;

            if (glass.Contains(x, y))
            {
                glass.StartDrag(x, y, args.Time);
            }
            else if (has_limits && min_limit.Contains(x, y))
            {
                min_limit.StartDrag(x, y, args.Time);
            }
            else if (has_limits && max_limit.Contains(x, y))
            {
                max_limit.StartDrag(x, y, args.Time);
            }
            else
            {
                int position;
                if (BoxHit(x, y, out position))
                {
                    BoxXHitFilled(x, out position);
                    glass.UpdateGlass = true;
                    glass.SetPosition(position);
                    glass.UpdateGlass = false;
                    return(true);
                }
            }

            return(base.OnButtonPressEvent(args));
        }
Example #3
0
        private static List <Type> GetConnectionTypes(Assembly assembly, IsSpecificType isSpecificType)
        {
            if (Limit == null)
            {
                Limit = new string[0];
            }

            IEnumerable <Type> a = null;

            try
            {
                a =
                    from t in assembly.GetTypes()
                    where t != null && t.IsClass && t.IsPublic
                    select t;
            }
            catch (ReflectionTypeLoadException ex)
            {
                a =
                    from t in ex.Types
                    where t != null && t.IsClass && t.IsPublic
                    select t;
            }


            List <Type> types = new List <Type>();

            foreach (Type type in a)
            {
                if (type != null)
                {
                    if (isSpecificType(type))    //(IsConnectionType(type))
                    {
                        // If the user is not allowed to
                        // use all available connections e.g.
                        // if the user has a freeware version.
                        if (!Limit.Contains(GetProtocolName(type)))
                        {
                            types.Add(type);
                        }
                    }
                }
            }

            return(types);
        }