Esempio n. 1
0
        public override void ThemeChanged()
        {
            if (Theme != null)
            {
                if (HeaderView != null)
                {
                    var headerLabel = HeaderView.Subviews[0] as UILabel;

                    headerLabel.Text = Caption;

                    if (Theme.HeaderTextFont != null)
                    {
                        headerLabel.Font = Theme.HeaderTextFont;
                    }
                    if (Theme.HeaderTextColor != null)
                    {
                        headerLabel.TextColor = Theme.HeaderTextColor;
                    }
                    if (Theme.HeaderTextShadowColor != null)
                    {
                        headerLabel.ShadowColor = Theme.HeaderTextShadowColor;
                    }
                    if (Theme.HeaderTextShadowOffset != SizeF.Empty)
                    {
                        headerLabel.ShadowOffset = Theme.HeaderTextShadowOffset;
                    }
                }

                if (FooterView != null)
                {
                    var footerLabel = FooterView as UILabel;

                    footerLabel.Text = FooterText.Replace("\n", "");

                    if (Theme.FooterTextFont != null)
                    {
                        footerLabel.Font = DetailTextFont;
                    }
                    if (Theme.FooterTextColor != null)
                    {
                        footerLabel.TextColor = Theme.FooterTextColor;
                    }
                    if (Theme.FooterTextShadowColor != null)
                    {
                        footerLabel.ShadowColor = Theme.FooterTextShadowColor;
                    }
                    if (Theme.FooterTextShadowOffset != SizeF.Empty)
                    {
                        footerLabel.ShadowOffset = Theme.FooterTextShadowOffset;
                    }
                }
            }
        }
Esempio n. 2
0
        void ReleaseDesignerOutlets()
        {
            if (Image != null)
            {
                Image.Dispose();
                Image = null;
            }

            if (HeaderText != null)
            {
                HeaderText.Dispose();
                HeaderText = null;
            }

            if (FooterText != null)
            {
                FooterText.Dispose();
                FooterText = null;
            }

            if (ButtonDetails != null)
            {
                ButtonDetails.Dispose();
                ButtonDetails = null;
            }

            if (ButtonCancel != null)
            {
                ButtonCancel.Dispose();
                ButtonCancel = null;
            }

            if (ButtonSend != null)
            {
                ButtonSend.Dispose();
                ButtonSend = null;
            }

            if (Details != null)
            {
                Details.Dispose();
                Details = null;
            }

            if (ScrollView != null)
            {
                ScrollView.Dispose();
                ScrollView = null;
            }
        }
Esempio n. 3
0
        public string GetProperty(string propertyName, string format, CultureInfo formatProvider, UserInfo accessingUser, Scope accessLevel, ref bool propertyNotFound)
        {
            var outputFormat = string.Empty;

            if (format == string.Empty)
            {
                outputFormat = "g";
            }
            var lowerPropertyName = propertyName.ToLowerInvariant();

            if (accessLevel == Scope.NoSettings)
            {
                propertyNotFound = true;
                return(PropertyAccess.ContentLocked);
            }
            propertyNotFound = true;
            var result   = string.Empty;
            var isPublic = true;

            switch (lowerPropertyName)
            {
            case "url":
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(PortalAlias.HTTPAlias, format);
                break;

            case "fullurl":     //return portal alias with protocol
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(Globals.AddHTTP(PortalAlias.HTTPAlias), format);
                break;

            case "passwordreminderurl":     //if regsiter page defined in portal settings, then get that page url, otherwise return home page.
                propertyNotFound = false;
                var reminderUrl = Globals.AddHTTP(PortalAlias.HTTPAlias);
                if (RegisterTabId > Null.NullInteger)
                {
                    reminderUrl = Globals.RegisterURL(string.Empty, string.Empty);
                }
                result = PropertyAccess.FormatString(reminderUrl, format);
                break;

            case "portalid":
                propertyNotFound = false;
                result           = (PortalId.ToString(outputFormat, formatProvider));
                break;

            case "portalname":
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(PortalName, format);
                break;

            case "homedirectory":
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(HomeDirectory, format);
                break;

            case "homedirectorymappath":
                isPublic         = false;
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(HomeDirectoryMapPath, format);
                break;

            case "logofile":
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(LogoFile, format);
                break;

            case "footertext":
                propertyNotFound = false;
                var footerText = FooterText.Replace("[year]", DateTime.Now.Year.ToString());
                result = PropertyAccess.FormatString(footerText, format);
                break;

            case "expirydate":
                isPublic         = false;
                propertyNotFound = false;
                result           = (ExpiryDate.ToString(outputFormat, formatProvider));
                break;

            case "userregistration":
                isPublic         = false;
                propertyNotFound = false;
                result           = (UserRegistration.ToString(outputFormat, formatProvider));
                break;

            case "banneradvertising":
                isPublic         = false;
                propertyNotFound = false;
                result           = (BannerAdvertising.ToString(outputFormat, formatProvider));
                break;

            case "currency":
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(Currency, format);
                break;

            case "administratorid":
                isPublic         = false;
                propertyNotFound = false;
                result           = (AdministratorId.ToString(outputFormat, formatProvider));
                break;

            case "email":
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(Email, format);
                break;

            case "hostfee":
                isPublic         = false;
                propertyNotFound = false;
                result           = (HostFee.ToString(outputFormat, formatProvider));
                break;

            case "hostspace":
                isPublic         = false;
                propertyNotFound = false;
                result           = (HostSpace.ToString(outputFormat, formatProvider));
                break;

            case "pagequota":
                isPublic         = false;
                propertyNotFound = false;
                result           = (PageQuota.ToString(outputFormat, formatProvider));
                break;

            case "userquota":
                isPublic         = false;
                propertyNotFound = false;
                result           = (UserQuota.ToString(outputFormat, formatProvider));
                break;

            case "administratorroleid":
                isPublic         = false;
                propertyNotFound = false;
                result           = (AdministratorRoleId.ToString(outputFormat, formatProvider));
                break;

            case "administratorrolename":
                isPublic         = false;
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(AdministratorRoleName, format);
                break;

            case "registeredroleid":
                isPublic         = false;
                propertyNotFound = false;
                result           = (RegisteredRoleId.ToString(outputFormat, formatProvider));
                break;

            case "registeredrolename":
                isPublic         = false;
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(RegisteredRoleName, format);
                break;

            case "description":
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(Description, format);
                break;

            case "keywords":
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(KeyWords, format);
                break;

            case "backgroundfile":
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(BackgroundFile, format);
                break;

            case "admintabid":
                isPublic         = false;
                propertyNotFound = false;
                result           = AdminTabId.ToString(outputFormat, formatProvider);
                break;

            case "supertabid":
                isPublic         = false;
                propertyNotFound = false;
                result           = SuperTabId.ToString(outputFormat, formatProvider);
                break;

            case "splashtabid":
                isPublic         = false;
                propertyNotFound = false;
                result           = SplashTabId.ToString(outputFormat, formatProvider);
                break;

            case "hometabid":
                isPublic         = false;
                propertyNotFound = false;
                result           = HomeTabId.ToString(outputFormat, formatProvider);
                break;

            case "logintabid":
                isPublic         = false;
                propertyNotFound = false;
                result           = LoginTabId.ToString(outputFormat, formatProvider);
                break;

            case "registertabid":
                isPublic         = false;
                propertyNotFound = false;
                result           = RegisterTabId.ToString(outputFormat, formatProvider);
                break;

            case "usertabid":
                isPublic         = false;
                propertyNotFound = false;
                result           = UserTabId.ToString(outputFormat, formatProvider);
                break;

            case "defaultlanguage":
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(DefaultLanguage, format);
                break;

            case "users":
                isPublic         = false;
                propertyNotFound = false;
                result           = Users.ToString(outputFormat, formatProvider);
                break;

            case "pages":
                isPublic         = false;
                propertyNotFound = false;
                result           = Pages.ToString(outputFormat, formatProvider);
                break;

            case "contentvisible":
                isPublic = false;
                break;

            case "controlpanelvisible":
                isPublic         = false;
                propertyNotFound = false;
                result           = PropertyAccess.Boolean2LocalizedYesNo(ControlPanelVisible, formatProvider);
                break;
            }
            if (!isPublic && accessLevel != Scope.Debug)
            {
                propertyNotFound = true;
                result           = PropertyAccess.ContentLocked;
            }
            return(result);
        }
Esempio n. 4
0
 public void Dispose()
 {
     HeaderText?.Dispose();
     FooterText?.Dispose();
     MenuItems?.Dispose();
 }
Esempio n. 5
0
        public void WriteStreamMulti(TextWriter writer, IEnumerable <T> records, int maxRecords)
        {
            if (writer == null)
            {
                throw new ArgumentNullException(nameof(writer), "The writer of the Stream can be null");
            }

            if (records == null)
            {
                throw new ArgumentNullException(nameof(records), "The records can be null. Try with an empty array.");
            }

            ResetFields();

            writer.NewLine = NewLineForWrite;

            if (!string.IsNullOrEmpty(HeaderText))
            {
                if (HeaderText.EndsWith(NewLineForWrite))
                {
                    writer.Write(HeaderText);
                }
                else
                {
                    writer.WriteLine(HeaderText);
                }
            }

            var max = records is IList?Math.Min(((IList)records).Count, maxRecords) : maxRecords;

            if (MustNotifyProgress) // Avoid object creation
            {
                OnProgress(new ProgressEventArgs(0, max));
            }

            var recIndex = 0;

            var    first       = true;
            string currentLine = null;

            foreach (var rec in records)
            {
                if (recIndex == maxRecords)
                {
                    break;
                }

                LineNumber++;
                try
                {
                    if (rec == null)
                    {
                        throw new BadUsageException($"The record at index {recIndex} is null.");
                    }

                    if (first)
                    {
                        first = false;
                        if (RecordInfo.RecordType.IsInstanceOfType(rec) == false)
                        {
                            throw new BadUsageException($"This engine works with record of type {RecordInfo.RecordType.Name} and you use records of type {rec.GetType().Name}");
                        }
                    }

                    var skip = false;

                    if (MustNotifyProgress) // Avoid object creation
                    {
                        OnProgress(new ProgressEventArgs(recIndex + 1, max));
                    }

                    if (MustNotifyWrite)
                    {
                        skip = OnBeforeWriteRecord(rec, LineNumber);
                    }

                    if (skip == false)
                    {
                        currentLine = RecordInfo.Operations.RecordToString(rec);
                        if (MustNotifyWrite)
                        {
                            currentLine = OnAfterWriteRecord(currentLine, rec);
                        }
                        writer.WriteLine(currentLine);
                    }
                }
                catch (Exception ex)
                {
                    switch (ErrorManager.ErrorMode)
                    {
                    case ErrorMode.ThrowException: throw;

                    case ErrorMode.IgnoreAndContinue: break;

                    case ErrorMode.SaveAndContinue:
                        var err = new ErrorInfo
                        {
                            LineNumber    = LineNumber,
                            ExceptionInfo = ex,
                            Text          = currentLine
                        };
                        ErrorManager.AddError(err);
                        break;

                    default:
                        throw new ArgumentOutOfRangeException();
                    }
                }
                recIndex++;
            }

            TotalRecords = recIndex;

            if (string.IsNullOrEmpty(FooterText))
            {
                return;
            }
            if (FooterText.EndsWith(NewLineForWrite))
            {
                writer.Write(FooterText);
            }
            else
            {
                writer.WriteLine(FooterText);
            }
        }