예제 #1
0
        //////////////////////////////////////////////////////////////////////
        // Get the array of installed application
        /// <include file='doc\MyWeb.uex' path='docs/doc[@for="MyWeb.GetInstalledApplications"]/*' />
        /// <internalonly/>
        /// <devdoc>
        ///    <para>Marked internal for Beta 1 per ErikOls.</para>
        ///    <para>Returns an array consisting of all installed MyWeb applications. Returns
        ///    <see langword='null'/> if there are no installed applications, or if not running
        ///       in the context of the administrative application (as determined by the Uri
        ///       obtained from the context).</para>
        /// </devdoc>
        static public MyWebApplication [] GetInstalledApplications()
        {
            if (!RunningOnMyWeb || !IsAdminApp())
            {
                return(null);
            }

            MyWebApplication [] apps = null;
            int iNumApps             = 0;
            int iter = 0;

            iNumApps = NativeMethods.MyWebGetNumInstalledApplications();
            if (iNumApps < 1)
            {
                return(null);
            }

            apps = new MyWebApplication[iNumApps];
            for (iter = 0; iter < iNumApps; iter++)
            {
                apps[iter] = new MyWebApplication(iter);
            }

            Array.Sort(apps, InvariantComparer.Default);
            return(apps);
        }
예제 #2
0
        /// <include file='doc\MyWeb.uex' path='docs/doc[@for="MyWebApplication.CompareTo"]/*' />
        /// <devdoc>
        ///    <para>Marked internal for Beta 1 per ErikOls.</para>
        /// </devdoc>
        public int  CompareTo(Object obj)
        {
            if (obj == null)
            {
                return(1);
            }

            if (!(obj is MyWebApplication))
            {
                throw new ArgumentException();
            }

            MyWebApplication myWebApp = (MyWebApplication)obj;
            String           strThis  = (Manifest.Name.Length < 1 ? Manifest.ApplicationUrl : Manifest.Name);
            String           strOther = (myWebApp.Manifest.Name.Length < 1 ? myWebApp.Manifest.ApplicationUrl : myWebApp.Manifest.Name);

            return(String.Compare(strThis, strOther, false, CultureInfo.InvariantCulture));
        }