コード例 #1
0
        protected override void OnAttached()
        {
            TypefaceEffect typefaceEffect = (TypefaceEffect)Element.Effects.First(e => e is TypefaceEffect);

            string fontFamily;

            switch (typefaceEffect.Name)
            {
            case TypefaceEffect.InstalledTypeface.MonospaceTypewriter:
                fontFamily = "MonospaceTypewriter";
                break;

            case TypefaceEffect.InstalledTypeface.Immortal:
                fontFamily = "Immortal";
                break;

            default:
                fontFamily = null;
                break;
            }

            try
            {
                switch (Control)
                {
                case UILabel lbl:
                    Xamarin.Forms.Label lblElem = Element as Xamarin.Forms.Label;
                    if (lblElem != null)
                    {
                        prevUIFont         = lbl.Font;
                        lbl.Font           = UIFont.FromName(fontFamily, new System.nfloat(lblElem.FontSize));
                        lblElem.FontFamily = lbl.Font.FamilyName;
                    }
                    break;

                case UITextField tf:
                    Xamarin.Forms.Picker tfElem = Element as Xamarin.Forms.Picker;
                    if (tfElem != null)
                    {
                        prevUIFont = tf.Font;
                        tf.Font    = UIFont.FromName(fontFamily, new System.nfloat(12f));
                    }
                    break;

                case UIButton b:
                    Xamarin.Forms.Button bElem = Element as Xamarin.Forms.Button;
                    if (bElem != null)
                    {
                        prevUIFont       = b.Font;
                        b.Font           = UIFont.FromName(fontFamily, new System.nfloat(bElem.FontSize));
                        bElem.FontFamily = b.Font.FamilyName;
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Cannot set property on attached control. Error: ", ex.Message);
            }
        }
コード例 #2
0
        public override IView ConvertTo(FigmaNode currentNode, ProcessedNode parent, FigmaRendererService rendererService)
        {
            var view = new Xamarin.Forms.Button();

            view.Configure(currentNode);

            var keyValues = GetKeyValues(currentNode);

            foreach (var key in keyValues)
            {
                if (key.Key == "type")
                {
                    continue;
                }

                if (key.Key == "enabled")
                {
                    view.IsEnabled = key.Value == "true";
                }
            }
            if (currentNode is IFigmaDocumentContainer instance)
            {
                var figmaText = instance.children.OfType <FigmaText>().FirstOrDefault(s => s.name == "title");
                if (figmaText != null)
                {
                    view.Opacity = figmaText.opacity;
                    view.Font    = figmaText.style.ToFont();
                    view.Text    = figmaText.characters;
                }
            }

            return(new LiteForms.Forms.View(view));
        }
コード例 #3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(savedInstanceState);
            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
            var app = new App();

            LoadApplication(app);

            //Assign controls and add handlers
            labelInfo     = (Xamarin.Forms.Label)app.MainPage.FindByName("labelInfo");
            labelMotorP   = (Xamarin.Forms.Label)app.MainPage.FindByName("labelMotorP");
            labelESPP     = (Xamarin.Forms.Label)app.MainPage.FindByName("labelESPP");
            ButtonConnect = (Xamarin.Forms.Button)app.MainPage.FindByName("ButtonConnect");
            ButtonLF      = (Xamarin.Forms.Button)app.MainPage.FindByName("ButtonLF");
            ButtonLS      = (Xamarin.Forms.Button)app.MainPage.FindByName("ButtonLS");
            ButtonLB      = (Xamarin.Forms.Button)app.MainPage.FindByName("ButtonLB");
            ButtonRF      = (Xamarin.Forms.Button)app.MainPage.FindByName("ButtonRF");
            ButtonRS      = (Xamarin.Forms.Button)app.MainPage.FindByName("ButtonRS");
            ButtonRB      = (Xamarin.Forms.Button)app.MainPage.FindByName("ButtonRB");

            ButtonConnect.Clicked += ButtonConnect_CLicked;
            ButtonLF.Clicked      += ButtonLF_CLicked;
            ButtonLS.Clicked      += ButtonLS_CLicked;
            ButtonLB.Clicked      += ButtonLB_CLicked;
            ButtonRF.Clicked      += ButtonRF_CLicked;
            ButtonRS.Clicked      += ButtonRS_CLicked;
            ButtonRB.Clicked      += ButtonRB_CLicked;


            CheckBt();
        }
コード例 #4
0
 public static void ApplyTo(Xamarin.Forms.Button button)
 {
     if (button?.Effects is IList <Xamarin.Forms.Effect> effects && !effects.Any(e => e.GetType() == typeof(ButtonEffect)))
     {
         button.Effects.Add(new ButtonEffect());
     }
 }
コード例 #5
0
        private void OnCustomEdit(object sender, EventArgs e, object v)
        {
            Xamarin.Forms.Button button = (Xamarin.Forms.Button)sender;
            int            id           = Convert.ToInt32(button.CommandParameter);
            SavedRollsView test         = (SavedRollsView)v;

            test.EditRoll(id);
        }
コード例 #6
0
 public static bool UpdateProperty(this Xamarin.Forms.Button fView, string property, object value)
 {
     switch (property)
     {
     case nameof(Button.Text):
         fView.Text = (string)value;
         return(true);
     }
     return(fView.UpdateBaseProperty(property, value));
 }
コード例 #7
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            //Get the shared instance
            var manager = BITHockeyManager.SharedHockeyManager;

            //Configure it to use our APP_ID
            manager.Configure(HOCKEYAPP_APPID);

            manager.LogLevel = BITLogLevel.Debug;

            //Start the manager
            manager.StartManager();

            //Authenticate (there are other authentication options)
            manager.Authenticator.AuthenticateInstallation();

            var checkForUpdatesButton = new Xamarin.Forms.Button {
                Text = "Check for Updates"
            };

            checkForUpdatesButton.Clicked += (sender, e) => {
                manager.UpdateManager.CheckForUpdate();
            };

            var showFeedbackButton = new Xamarin.Forms.Button {
                Text = "Show Feedback"
            };

            showFeedbackButton.Clicked += (sender, e) => {
                manager.FeedbackManager.ShowFeedbackListView();
            };

            var submitNewFeedbackButton = new Xamarin.Forms.Button {
                Text = "Submit New Feedback"
            };

            submitNewFeedbackButton.Clicked += (sender, e) => {
                manager.FeedbackManager.ShowFeedbackComposeView();
            };

            var throwExceptionButton = new Xamarin.Forms.Button {
                Text = "Throw Managed .NET Exception"
            };

            throwExceptionButton.Clicked += (sender, e) => {
                throw new HockeyAppSampleException("You intentionally caused a crash!");
            };

            global::Xamarin.Forms.Forms.Init();

            LoadApplication(new App(checkForUpdatesButton, showFeedbackButton, submitNewFeedbackButton, throwExceptionButton));

            return(base.FinishedLaunching(app, options));
        }
コード例 #8
0
 public Windows.UI.Xaml.Controls.Button Get_UWPButton(Xamarin.Forms.Button button)
 {
     foreach (Xamarin.Forms.Effect e in button.Effects)
     {
         PlatformEffect platformEffect = e as PlatformEffect;
         if (platformEffect != null)
         {
             return(platformEffect.Control as Windows.UI.Xaml.Controls.Button);
         }
     }
     return(null);
 }
コード例 #9
0
        /// <summary>
        /// 添加产品类型对象
        /// </summary>
        /// <param name="item"></param>
        private void AddProductTypeItem(ProductTypeStateModel item)
        {
            Xamarin.Forms.Button btn = new Xamarin.Forms.Button();

            btn.SetBinding(Xamarin.Forms.Button.TextProperty, new Xamarin.Forms.Binding("ProductTypeName"));
            btn.BackgroundColor  = Xamarin.Forms.Color.Transparent;
            btn.Margin           = new Xamarin.Forms.Thickness(10, 0);
            btn.BindingContext   = item;
            btn.Command          = GoProductType;
            btn.CommandParameter = item;
            _spProductTypeList.Children.Add(btn);
        }
コード例 #10
0
 public Button Get_AndroidButton(Xamarin.Forms.Button button)
 {
     foreach (Xamarin.Forms.Effect e in button.Effects)
     {
         PlatformEffect platformEffect = e as PlatformEffect;
         if (platformEffect != null)
         {
             return(platformEffect.Control as Button);
         }
     }
     return(null);
 }
コード例 #11
0
        private async void OnCustomDelete(object sender, EventArgs e, object v)
        {
            Xamarin.Forms.Button button  = (Xamarin.Forms.Button)sender;
            RollItem             delRoll = new RollItem
            {
                RollID = Convert.ToInt32(button.CommandParameter.ToString())
            };
            await App.Database.DeleteItemAsync(delRoll);

            SavedRollsView test = (SavedRollsView)v;

            test.RefreshView();
        }
コード例 #12
0
        private App CreateApp()
        {
            var app = new App();

            var ThrowNativeJavaExceptionButton = new Xamarin.Forms.Button {
                Text = "Throw Native Java Exception"
            };

            ThrowNativeJavaExceptionButton.Clicked += ThrowNativeJavaException;

            app.AddChild(ThrowNativeJavaExceptionButton);

            return(app);
        }
コード例 #13
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            global::Xamarin.Forms.Forms.Init();

            var feedbackButton = new Xamarin.Forms.Button()
            {
                Text = "Feedback"
            };

            feedbackButton.Clicked += (sender, e) =>
            {
                //FeedbackManager.Register(this, appId);
                //FeedbackManager.ShowFeedbackActivity(this);
            };

            LoadApplication(new App(feedbackButton));

            return(base.FinishedLaunching(app, options));
        }
コード例 #14
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            const string appId = "13811f19fe0540a184511b18374628d1";

            CrashManager.Register(this, appId);
            MetricsManager.Register(Application, appId);

            var feedbackButton = new Xamarin.Forms.Button()
            {
                Text = "Feedback"
            };

            feedbackButton.Clicked += (sender, e) => {
                FeedbackManager.Register(this, appId);
                FeedbackManager.ShowFeedbackActivity(this);
            };

            global::Xamarin.Forms.Forms.Init(this, bundle);
            LoadApplication(new App(feedbackButton));
        }
コード例 #15
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            HockeyLog.LogLevel = 3;

            // Register the crash manager before Initializing the trace writer
            CrashManager.Register(this, HOCKEYAPP_APPID);

            //Register to with the Update Manager
            UpdateManager.Register(this, HOCKEYAPP_APPID);

            MetricsManager.Register(Application, HOCKEYAPP_APPID);

            var showFeedbackButton = new Xamarin.Forms.Button {
                Text = "Show Feedback"
            };

            showFeedbackButton.Clicked += (sender, e) => {
                //Register with the feedback manager
                FeedbackManager.Register(this, HOCKEYAPP_APPID, null);

                //Show the feedback screen
                FeedbackManager.ShowFeedbackActivity(this);
            };

            var causeCrashButton = new Xamarin.Forms.Button {
                Text = "Cause Crash"
            };

            causeCrashButton.Clicked += (sender, e) => {
                // Throw a deliberate sample crash
                throw new HockeyAppSampleException("You intentionally caused a crash!");
            };

            global::Xamarin.Forms.Forms.Init(this, bundle);

            LoadApplication(new App(showFeedbackButton, causeCrashButton));
        }
コード例 #16
0
        public void GeneratePdfFile(string text)
        {
            PrintAttributes printAttrs = new PrintAttributes.Builder()
                                         .SetColorMode(PrintColorMode.Color)
                                         .SetMediaSize(PrintAttributes.MediaSize.IsoA4)
                                         .SetResolution(new PrintAttributes.Resolution("guardianHealthId", "TestReport", 592, 842))
                                         .SetMinMargins(PrintAttributes.Margins.NoMargins)
                                         .Build();

            // Create a document
            PdfDocument document = new PrintedPdfDocument(Android.App.Application.Context, printAttrs);

            // Create a page description
            // A4 : Page size
            // pageWidth The page width in PostScript (1/72th of an inch)
            // pageHeight The page height in PostScript(1 / 72th of an inch).
            PageInfo pageInfo = new PageInfo.Builder(592, 842, 1).Create();

            PdfDocument.Page page = document.StartPage(pageInfo);

            Xamarin.Forms.Button btn = new Xamarin.Forms.Button();


            // File to create page
            File path = GetDirectoryPath();

            System.IO.FileStream fileStream = new System.IO.FileStream(path.ToString(), System.IO.FileMode.Create);

            Canvas canvas = page.Canvas;
            Paint  paint  = new Paint();

            canvas.DrawText("This is a demo pdf file.\n" + text, 10, 10, paint);

            document.FinishPage(page);
            document.WriteTo(fileStream);
            document.Close();
            fileStream.Close();
        }
コード例 #17
0
 public RoomsDetailViewModel(Room item = null, Xamarin.Forms.Button bookButton = null)
 {
     Title = item?.Text;
     Item  = item;
 }
コード例 #18
0
 public FigmaTransitionImageButton(Xamarin.Forms.Button button) : base(button)
 {
 }
コード例 #19
0
 public TransitionButton(Xamarin.Forms.Button button) : base(button)
 {
 }
コード例 #20
0
 public override void ClickButton(Xamarin.Forms.Button button)
 {
     this.ClickButton(this.Get_UWPButton(button));
 }
コード例 #21
0
 public override void MakeButtonAppearPressed(Xamarin.Forms.Button button)
 {
     button.BackgroundColor = Color.Green;
 }
コード例 #22
0
 public static void UpdateProperties(this Xamarin.Forms.Button fView, Button view)
 {
     fView.UpdateBaseProperties(view);
     fView.Text = view.Text;
 }
コード例 #23
0
 public override void ClickButton(Xamarin.Forms.Button button)
 {
     button.BackgroundColor = Xamarin.Forms.Color.FromRgba(0, 0, 0, 0);
     ClickButton(Get_AndroidButton(button));
 }