Пример #1
0
        public override void WindowDidLoad()
        {
            base.WindowDidLoad();

            Window.BackgroundColor = NSColor.White;
            ContentTextView.EnclosingScrollView.BorderType = NSBorderType.NoBorder;

            Window.Title           = "";
            AboutTitle.StringValue = "About Lexisnexis Legal & Professional";
            if (GlobalAccess.Instance.CurrentUserInfo != null)
            {
                LastSyncTime.StringValue = "Latest server sync " + SettingsUtil.Instance.GetLastSyncedTime().ToString("HH:mmtt dd MMM yyyy");
            }
            else
            {
                LastSyncTime.StringValue = "";
            }


            LoginUserDetails userDetail = GlobalAccess.Instance.CurrentUserInfo;

            if (userDetail == null)
            {
                string filePath    = NSBundle.MainBundle.PathForResource("/Images/Setting/LexisNexisLegal", "htm");
                NSData fileHtmData = NSData.FromFile(filePath);

                NSDictionary docAttribute = new NSDictionary();
                var          htmContent   = NSAttributedString.CreateWithHTML(fileHtmData, out docAttribute);
                //new NSAttributedString (fileHtmData, out docAttribute);

                ContentTextView.TextStorage.SetString(htmContent);
                return;
            }

            var htmlString = SettingsUtil.Instance.GetLexisNexisInfo();

            htmlString = htmlString.Replace("font-size:12px;", "font-size:12px;\n font-family: \"HelveticaNeue-Medium\";");
            //htmlString = htmlString.Replace ("line-height:16px;", "line-height:14pt;");
            htmlString = htmlString.Replace("<h3>\nLexisNexis Legal & Professional \n</h3>", "");
            htmlString = htmlString.Replace("color:#000000;", "color:#808085;");               //# 808085 6D6D72
            var          nsString      = new NSString(htmlString);
            var          fileData      = nsString.Encode(NSStringEncoding.UTF8);
            NSDictionary docAttributeo = new NSDictionary();
            var          url           = new NSUrl("");
            var          content       = new NSAttributedString(fileData, url, out docAttributeo);

            ContentTextView.TextStorage.SetString(content);
        }
Пример #2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            if (View != null && View.Frame.IsEmpty == false)
            {
                InitialHeight = View.Frame.Height;
            }

            CustomButtonStyles.ApplyStyleMainButton(GuiButtonLogIn, LocalizedStrings.Instance.LocalizedString("Button_LogIn"));

            CustomButtonStyles.ApplyStyleNavigationButtonV2(GuiButtonStartFreeTrial, LocalizedStrings.Instance.LocalizedString("Button_StartFreeTrial"));

            GuiTextViewUser.PlaceholderString = LocalizedStrings.Instance.LocalizedString("Placeholder_Username");
            GuiTextViewUser.Cell.Title        = __LogInViewModel.UserName ?? "";
            GuiTextViewUser.LineBreakMode     = NSLineBreakMode.TruncatingHead;

            // ACCOUNT ID DESCRIPTION ...
            // Initialize Account ID description text with link to a Client Area
            NSData             descriptionData = NSData.FromString("Your account ID can be found in the <a style=\"text-decoration:none\" href=\"https://www.ivpn.net/clientarea/login\">Client Area</a> of the website");
            NSDictionary       resultDocumentAttributes;
            NSAttributedString nSAttributed = NSAttributedString.CreateWithHTML(descriptionData, out resultDocumentAttributes);

            NSStringAttributes descTextAttributes = new NSStringAttributes();

            descTextAttributes.Font            = GuiTextAccountIdDescription.Font;      // keep using preconfigured TextField font
            descTextAttributes.ForegroundColor = GuiTextAccountIdDescription.TextColor; // keep using preconfigured TextField color
            descTextAttributes.ParagraphStyle  = new NSMutableParagraphStyle {
                Alignment = NSTextAlignment.Center
            };

            NSMutableAttributedString descriptionString = new NSMutableAttributedString(nSAttributed);

            descriptionString.AddAttributes(descTextAttributes, new NSRange(0, nSAttributed.Length));

            GuiTextAccountIdDescription.AllowsEditingTextAttributes = true;        // it is important
            GuiTextAccountIdDescription.Selectable            = true;
            GuiTextAccountIdDescription.AttributedStringValue = descriptionString; // nSAttributed;
            // ... ACCOUNT ID DESCRIPTION

            GuiButtonLogIn.Hidden = false;

            View.OnApperianceChanged += () =>
            {
                CustomButtonStyles.ApplyStyleNavigationButtonV2(GuiButtonStartFreeTrial, LocalizedStrings.Instance.LocalizedString("Button_StartFreeTrial"));
            };
        }