Exemplo n.º 1
0
 public override bool CheckUserAccessPermission(System.ComponentModel.Component component)
 {
     Model.Common.User currentUser = Setting.User.ThisProgram.GetCurrentUser <Model.Common.User>();
     if (currentUser == null)
     {
         return(true);
     }
     if (IsMembershipInAdministartorRole(currentUser))
     {
         return(true);
     }
     if (component is Njit.Program.ComponentOne.Controls.RibbonButton)
     {
         Njit.Program.ComponentOne.Controls.RibbonButton button = component as Njit.Program.ComponentOne.Controls.RibbonButton;
         if (button.OwnerControl == null)
         {
             return(true);
         }
         System.Windows.Forms.Form form = button.OwnerControl.FindForm();
         if (form == null)
         {
             return(true);
         }
         return(this.CheckUserAccessPermission(currentUser, (button as Njit.Common.IAccessPermission).GetPath(), form.Name));
     }
     else
     {
         return(true);
     }
 }
Exemplo n.º 2
0
        public ComponentTester <TComp> FindComponent <TComp>(string UniqueName, bool IgnoreCase) where TComp : System.ComponentModel.Component
        {
            ComponentTester <TComp> ret = null;

            System.ComponentModel.Component comp = null;
            if (this.Control == null)
            {
                throw new NullReferenceException("Cannot find the container of current component.");
            }
            else
            {
                Type   formType = this.Control.GetType();
                string compName = string.Format("_{0}", UniqueName);
                foreach (System.Reflection.FieldInfo field in formType.GetFields(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance))
                {
                    // VB.Net will prefixing with "_" for the components but will not in C# so here needs to check both of them.
                    if (string.Compare(field.Name, compName, IgnoreCase) == 0 ||
                        string.Compare(field.Name, UniqueName, IgnoreCase) == 0)
                    {
                        comp = (System.ComponentModel.Component)field.GetValue(this.Control);
                        if (comp is TComp)
                        {
                            break;
                        }
                    }
                }
            }
            if (comp != null)
            {
                ret = new ComponentTester <TComp>((TComp)comp);
            }
            return(ret);
        }
        //****************************************

        internal void AttachTo(GuiPresenter presenter, System.ComponentModel.Component targetControl)
        {
            _Presenter = presenter;

            if (targetControl is ButtonBase)
            {
                (targetControl as ButtonBase).Click += OnCommand;
            }
            else if (targetControl is LinkLabel)
            {
                (targetControl as LinkLabel).Click += OnCommand;
            }
            else if (targetControl is ToolStripButton)
            {
                (targetControl as ToolStripButton).Click += OnCommand;
            }
            else if (targetControl is ToolStripDropDownButton)
            {
                (targetControl as ToolStripDropDownButton).Click += OnCommand;
            }
            else
            {
                throw new ArgumentException("Target Control does not support Command bindings");
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Поиск записи из коллекции.
        /// </summary>
        public static int FindRecordPossition(System.ComponentModel.Component сollection, XPBaseObject record)
        {
            if (record == null)
            {
                return(0);
            }

            if (сollection is XPCollection)
            {
                XPCollection xpCollection = сollection as XPCollection;
                string       propertyName = DBAttribute.GetKey(record.GetType());
                int          idRecord     = (int)record.GetMemberValue(propertyName);

                for (int i = 0; i < xpCollection.Count; i++)
                {
                    XPBaseObject recordInt = (XPBaseObject)xpCollection[i];

                    int idRecordInt = (int)recordInt.GetMemberValue(propertyName);

                    if (idRecordInt == idRecord)
                    {
                        return(i);
                    }
                }
            }
            return(0);
        }
Exemplo n.º 5
0
        public void InvokePaintBackground(System.ComponentModel.Component c, PaintEventArgs e)
        {
            int borderWidth = 2;

            e.Graphics.TranslateTransform(0 - borderWidth, 0 - borderWidth);
            tsBase_Paint(c, e);
            e.Graphics.ResetTransform();
        }
Exemplo n.º 6
0
        public DialogRunner(System.ComponentModel.Component dialog)
        {
            commonDialog = dialog as SWF.CommonDialog;
            if (commonDialog == null)
            {
                threadExceptionDialog = dialog as SWF.ThreadExceptionDialog;
            }
            if (commonDialog == null && threadExceptionDialog == null)
            {
                throw new ArgumentException("Unsupported dialog type: " + dialog);
            }

            Show();
        }
        /// <summary>
        /// Class Constructor.
        /// </summary>
        public ZipFileManager()
        {
            try
            {
                //  Instantiate the Component that will hold the Managed Resources used by this method.
                _component = new System.ComponentModel.Component();
            }
            catch
            {
                //  Exit this method.
                return;
            }

            //  Exit the constructor method.
            return;
        } //  ZipFileManager()
        /// <summary>
        /// Class Constructor.
        /// </summary>
        public ZipFileManager()
        {
            try
              {
            //  Instantiate the Component that will hold the Managed Resources used by this method.
            _component = new System.ComponentModel.Component();

              }
              catch
              {
            //  Exit this method.
            return;
              }

              //  Exit the constructor method.
              return;
        }
        public static bool _CreateObjRef_System_ComponentModel_Component_System_Type( )
        {
            //class object
            System.ComponentModel.Component _System_ComponentModel_Component = new System.ComponentModel.Component();

            //Parameters
            System.Type requestedType = null;

            //ReturnType/Value
            System.Runtime.Remoting.ObjRef returnVal_Real        = null;
            System.Runtime.Remoting.ObjRef returnVal_Intercepted = null;

            //Exception
            System.Exception exception_Real        = null;
            System.Exception exception_Intercepted = null;

            InterceptionMaintenance.disableInterception( );

            try
            {
                returnVal_Real = _System_ComponentModel_Component.CreateObjRef(requestedType);
            }

            catch (System.Exception e)
            {
                exception_Real = e;
            }


            InterceptionMaintenance.enableInterception( );

            try
            {
                returnVal_Intercepted = _System_ComponentModel_Component.CreateObjRef(requestedType);
            }

            catch (System.Exception e)
            {
                exception_Intercepted = e;
            }


            return((exception_Real.Messsage == exception_Intercepted.Message) && (returnValue_Real == returnValue_Intercepted));
        }
        public static bool _InitializeLifetimeService_System_ComponentModel_Component( )
        {
            //class object
            System.ComponentModel.Component _System_ComponentModel_Component = new System.ComponentModel.Component();

            //Parameters

            //ReturnType/Value
            System.Object returnVal_Real        = null;
            System.Object returnVal_Intercepted = null;

            //Exception
            System.Exception exception_Real        = null;
            System.Exception exception_Intercepted = null;

            InterceptionMaintenance.disableInterception( );

            try
            {
                returnVal_Real = _System_ComponentModel_Component.InitializeLifetimeService();
            }

            catch (System.Exception e)
            {
                exception_Real = e;
            }


            InterceptionMaintenance.enableInterception( );

            try
            {
                returnVal_Intercepted = _System_ComponentModel_Component.InitializeLifetimeService();
            }

            catch (System.Exception e)
            {
                exception_Intercepted = e;
            }


            return((exception_Real.Messsage == exception_Intercepted.Message) && (returnValue_Real == returnValue_Intercepted));
        }
        public static bool _CreateObjRef_System_ComponentModel_Component_System_Type( )
        {
            //class object
            System.ComponentModel.Component _System_ComponentModel_Component = new System.ComponentModel.Component();

               //Parameters
               System.Type requestedType = null;

               //ReturnType/Value
               System.Runtime.Remoting.ObjRef returnVal_Real = null;
               System.Runtime.Remoting.ObjRef returnVal_Intercepted = null;

               //Exception
               System.Exception exception_Real = null;
               System.Exception exception_Intercepted = null;

               InterceptionMaintenance.disableInterception( );

               try
               {
              returnVal_Real = _System_ComponentModel_Component.CreateObjRef(requestedType);
               }

               catch( System.Exception e )
               {
              exception_Real = e;
               }

               InterceptionMaintenance.enableInterception( );

               try
               {
              returnVal_Intercepted = _System_ComponentModel_Component.CreateObjRef(requestedType);
               }

               catch( System.Exception e )
               {
              exception_Intercepted = e;
               }

               return( ( exception_Real.Messsage == exception_Intercepted.Message ) && ( returnValue_Real == returnValue_Intercepted ) );
        }
        public static bool _GetLifetimeService_System_ComponentModel_Component( )
        {
            //class object
            System.ComponentModel.Component _System_ComponentModel_Component = new System.ComponentModel.Component();

               //Parameters

               //ReturnType/Value
               System.Object returnVal_Real = null;
               System.Object returnVal_Intercepted = null;

               //Exception
               System.Exception exception_Real = null;
               System.Exception exception_Intercepted = null;

               InterceptionMaintenance.disableInterception( );

               try
               {
              returnVal_Real = _System_ComponentModel_Component.GetLifetimeService();
               }

               catch( System.Exception e )
               {
              exception_Real = e;
               }

               InterceptionMaintenance.enableInterception( );

               try
               {
              returnVal_Intercepted = _System_ComponentModel_Component.GetLifetimeService();
               }

               catch( System.Exception e )
               {
              exception_Intercepted = e;
               }

               return( ( exception_Real.Messsage == exception_Intercepted.Message ) && ( returnValue_Real == returnValue_Intercepted ) );
        }
Exemplo n.º 13
0
        public static bool _Dispose_System_ComponentModel_Component( )
        {
            //class object
            System.ComponentModel.Component _System_ComponentModel_Component = new System.ComponentModel.Component();

            //Parameters


            //Exception
            System.Exception exception_Real        = null;
            System.Exception exception_Intercepted = null;

            InterceptionMaintenance.disableInterception( );

            try
            {
                _System_ComponentModel_Component.Dispose();
            }

            catch (System.Exception e)
            {
                exception_Real = e;
            }


            InterceptionMaintenance.enableInterception( );

            try
            {
                _System_ComponentModel_Component.Dispose();
            }

            catch (System.Exception e)
            {
                exception_Intercepted = e;
            }


            return((exception_Real.Message == exception_Intercepted.Message));
        }
        public static bool _Dispose_System_ComponentModel_Component( )
        {
            //class object
            System.ComponentModel.Component _System_ComponentModel_Component = new System.ComponentModel.Component();

               //Parameters

               //Exception
               System.Exception exception_Real = null;
               System.Exception exception_Intercepted = null;

               InterceptionMaintenance.disableInterception( );

               try
               {
              _System_ComponentModel_Component.Dispose();
               }

               catch( System.Exception e )
               {
              exception_Real = e;
               }

               InterceptionMaintenance.enableInterception( );

               try
               {
              _System_ComponentModel_Component.Dispose();
               }

               catch( System.Exception e )
               {
              exception_Intercepted = e;
               }

               return( ( exception_Real.Message == exception_Intercepted.Message ));
        }
        /// <summary>
        /// Class Constructor.
        /// </summary>
        public FeatureClassUtilities()
        {
            PDX.BTS.DataMaintenance.MaintTools.XMLSetttingsFileManager xmlFileManager    = null;
              PDX.BTS.DataMaintenance.MaintTools.EncryptionManager       encryptionManager = null;

              try
              {
            //  Set the Name of the XML Settings File for this Application.
            string applicationDirectory = System.Reflection.Assembly.GetExecutingAssembly().Location.ToString();
            while (applicationDirectory.EndsWith(@"\") == false)
            {
              //  Drop the right-most character from the string.
              applicationDirectory = applicationDirectory.Substring(0, (applicationDirectory.Length - 1));
            }
            string xmlSettingsFile = applicationDirectory + @"DataMaintenanceUtilitiesSettings.xml";

            //  Initialize the XML File Manager.
            xmlFileManager = new PDX.BTS.DataMaintenance.MaintTools.XMLSetttingsFileManager();
            xmlFileManager.XMLFile(xmlSettingsFile);

            if (!System.IO.File.Exists(xmlSettingsFile))
            {
              //  Let the user know that the Parameter Table could not be initialized.
              if (ErrorMessage != null)
              {
            ErrorMessage("     Could not find the XML Settings File!  Initialization Failed!");
              }

              //  Exit this process.
              return;

            }

            //  Get the connection parameters for the Monitor Database from the XML Settings File.
            _monitorDatabaseServerName = xmlFileManager.ReadUserSetting("DatabaseDefinitions", "MonitorDatabaseServer");
            _monitorDatabaseName = xmlFileManager.ReadUserSetting("DatabaseDefinitions", "MonitorDatabase");

            //  Get the Name of the Load Monitor Table in the Monitor Database.
            _parameterTableName = xmlFileManager.ReadUserSetting("DatabaseDefinitions", "LoadParemetersTableName");

            //  Set the Connection String that will be used to Connect to the Parameter Database.
            _parameterDatabaseConnectionString = "Data Source=" + _monitorDatabaseServerName +";"
                                           + "Initial Catalog=" + _monitorDatabaseName + ";"
                                           + "Integrated Security=SSPI";

            //  Instantiate the Component that will hold the Managed Resources used by this method.
            _component = new System.ComponentModel.Component();

            // Populate the Shapefile Extension Array.
            _shapefileExtensions = new System.Collections.ArrayList();
            _shapefileExtensions.Add("aih");
            _shapefileExtensions.Add("ain");
            _shapefileExtensions.Add("cpg");
            _shapefileExtensions.Add("dbf");
            _shapefileExtensions.Add("gcd");
            _shapefileExtensions.Add("ixs");
            _shapefileExtensions.Add("mxs");
            _shapefileExtensions.Add("prj");
            _shapefileExtensions.Add("sbn");
            _shapefileExtensions.Add("sbx");
            _shapefileExtensions.Add("shp");
            _shapefileExtensions.Add("shp.xml");
            _shapefileExtensions.Add("shx");
            _shapefileExtensions.Add("xml");

            //  Populate the Array of Shapefile Extensions that are necessary to have a valid Shapefile.
            _shapefileNecessaryExtensions = new System.Collections.ArrayList();
            _shapefileNecessaryExtensions.Add("shp");
            _shapefileNecessaryExtensions.Add("shx");
            _shapefileNecessaryExtensions.Add("dbf");

              }
              catch
              {
            //  Exit this method.
            return;

              }
              finally
              {
            //  If the CGIS Data Maintenance Encryption Manager Object was instantiated, close it.
            if (encryptionManager != null)
            {
              encryptionManager = null;
            }
            //  If the CGIS Data Maintenance XML File Manager Object was instantiated, close it.
            if (xmlFileManager != null)
            {
              xmlFileManager = null;
            }

              }
        }
Exemplo n.º 16
0
        public static string GetComponentResourceString(this System.ComponentModel.Component form, string resourceName)
        {
            var compResource = new System.ComponentModel.ComponentResourceManager(form.GetType());

            return(compResource.GetString(resourceName));
        }
Exemplo n.º 17
0
 public static bool IsDesignMode(System.ComponentModel.Component component)
 {
     return(IsDesignTime);
 }
 public CLASSNAME()
 {
     comp = new System.ComponentModel.Component();
 }
Exemplo n.º 19
0
 /// <summary>
 /// چک کردن اینکه آیا کاربر اجازه دسترسی به کامپوننت را دارد
 /// </summary>
 /// <param name="component">کامپوننت</param>
 public abstract bool CheckUserAccessPermission(System.ComponentModel.Component component);
Exemplo n.º 20
0
 public void InvokePaint(System.ComponentModel.Component c, PaintEventArgs e)
 {
 }
Exemplo n.º 21
0
 //TODO: test Atk.Role.Dialog when using ShowDialog() [currently threading problems]
 private void VerifyBasicProperties(System.ComponentModel.Component dialog)
 {
     UiaAtkBridge.Window dialogAdapter = BridgeTester.GetAdapterForWidget(dialog) as UiaAtkBridge.Window;
     Assert.IsNotNull(dialogAdapter, "dialogAdapter has a different type than Window");
     Assert.IsTrue(dialogAdapter.NAccessibleChildren > 0, "dialog should have children");
 }