Esempio n. 1
0
 private async void popupError_Clicked(object sender, EventArgs e)
 {
     await Task.Run(() =>
     {
         OverlayHelper.Open(new ExamplePopup2(), AbsoluteLayoutFlags.All,
                            new Rectangle(0, 0.5, 1, 0.3), Color.FromHex("#88000000"));
     });
 }
Esempio n. 2
0
        public MainWindow()
        {
            //Init XAML
            InitializeComponent();
            //Create note list
            _razer = Provider.Razer;
            _notes = new Dictionary<Rectangle,Pitch>();
            _notes.Add(NoteCS,Pitch.CSharp4);
            _notes.Add(NoteDS,Pitch.DSharp4);
            _notes.Add(NoteFS,Pitch.FSharp4);
            _notes.Add(NoteGS,Pitch.GSharp4);
            _notes.Add(NoteAS,Pitch.ASharp4);
            _notes.Add(NoteC,Pitch.C4);
            _notes.Add(NoteD,Pitch.D4);
            _notes.Add(NoteE,Pitch.E4);
            _notes.Add(NoteF,Pitch.F4);
            _notes.Add(NoteG,Pitch.G4);
            _notes.Add(NoteA,Pitch.A4);
            _notes.Add(NoteB,Pitch.B4);

            //sound device
            if (OutputDevice.InstalledDevices.Count > 0)
            {
                _outputDevice = OutputDevice.InstalledDevices[0];
                _outputDevice.Open();
                _outputDevice.SendProgramChange(Channel.Channel1, Instrument.AcousticGrandPiano);
            }
            else
                Application.Current.Shutdown();

            _overlayHelper = new OverlayHelper(NewMessageOverlay, NewMessageOverlayLabel);
            

            /* This sends the current window to the SBUI
             * We give it the Polling RenderMethod which updates
             * SBUI every 42ms (about 24FPS)
             */
            _razer.Touchpad.SetWindow(this, Touchpad.RenderMethod.Polling);

            _razer.EnableDynamicKey(RazerAPI.DynamicKeyType.DK1, OnPressPiano, @"Default\Images\Piano.png");
            _razer.EnableDynamicKey(RazerAPI.DynamicKeyType.DK2, OnPressGuitar, @"Default\Images\Guitar.png");
            _razer.EnableDynamicKey(RazerAPI.DynamicKeyType.DK3, OnPressEPiano, @"Default\Images\EPiano.png");
            _razer.EnableDynamicKey(RazerAPI.DynamicKeyType.DK4, OnPressXylophone, @"Default\Images\Xylo.png");
            _razer.EnableDynamicKey(RazerAPI.DynamicKeyType.DK5, OnPressSteelDrums, @"Default\Images\Drums.png");
            _razer.Touchpad.Gesture += TouchpadOnGesture;
            //_razer.Touchpad.EnableGesture(RazerAPI.GestureType.Press);
            _razer.Touchpad.EnableGesture(RazerAPI.GestureType.Move);
            _razer.Touchpad.EnableGesture(RazerAPI.GestureType.Tap);
            //_overlayHelper.Show("Ready to touch");

        }
Esempio n. 3
0
        private string FbkAction(Capability capability)
        {
            //filename to store sice id
            var storageIdentifier = capability.HashTag.Substring(1);

            List <string> HashTags = new List <string>()
            {
                _serviceInstance.BotConfiguration.BaseHashTag, capability.HashTag
            };
            List <TwitterStatus> tweets = _twitterHelper.GetTweets(storageIdentifier, HashTags);

            _statusText += $"Found {tweets.Count} tweets to reply to\n";

            //Iterate all found tweets
            foreach (var tweet in tweets)
            {
                //Build the reply message based on bots capabilities
                var reply = $"@{tweet.User.ScreenName} \n\n Your new profile picture!\n";

                //Get authors profile image url
                var profileImageUrl = tweet.Author.ProfileImageUrl.Replace("_normal", "_400x400");

                //Get the newly created profile picture
                var overlayImageUrl = Path.Combine(_serviceInstance.BotConfiguration.DataStorage.OverleyFolder, "fbk_logo.png");

                if (File.Exists(overlayImageUrl))
                {
                    var newProfileImageUrl = OverlayHelper.CreateLogoImage(profileImageUrl, overlayImageUrl);

                    if (newProfileImageUrl != null)
                    {
                        //Send tweet
                        _twitterHelper.SendTweet(storageIdentifier, tweet, reply, newProfileImageUrl);
                        _statusText += $"Reply to {tweet.Author.ScreenName} sent!\n";
                    }
                }
                else
                {
                    _statusText += "Cannot find overlay image!";
                }
            }

            return(_statusText);
        }
Esempio n. 4
0
 private void OK_Clicked(object sender, EventArgs e)
 {
     OverlayHelper.Open(new ExamplePopup2(), AbsoluteLayoutFlags.All,
                        new Rectangle(0, 1, 1, 0.3), Color.FromHex("#88000000"));
 }
Esempio n. 5
0
        private async void dropdown_Clicked(object sender, EventArgs e)
        {
            var button   = (Button)sender;
            var dropdown = new ContentView();

            var dropdownHeight  = 200;
            var dropdownContent = new Frame()
            {
                Margin          = new Thickness(20, 0),
                CornerRadius    = 20,
                HasShadow       = false,
                HeightRequest   = dropdownHeight,
                BackgroundColor = Color.FromHex("#F5F5F5"),
            };

            var list = new ListView()
            {
                BackgroundColor = Color.FromHex("#00000000"),
                ItemsSource     = new List <string> {
                    "test option 1",
                    "test option 2",
                    "test option 3",
                    "test option 4",
                    "test option 5",
                }
            };

            list.ItemSelected += ((object s, SelectedItemChangedEventArgs ev) =>
            {
                button.Text = ((string)((ListView)s).SelectedItem);
                OverlayHelper.Close();
            });

            dropdownContent.Content = list;

            dropdown.Content = dropdownContent;

            var dropdownContentY = button.Y + button.Height + 5;
            var parent           = (VisualElement)button.Parent;

            while (parent != null)
            {
                if (parent.Parent.GetType() == typeof(VisualElement) || parent.Parent.GetType() == typeof(ScrollView))
                {
                    if (parent.Parent.GetType() == typeof(VisualElement))
                    {
                        dropdownContentY += parent.Y;
                        parent            = (VisualElement)parent.Parent;
                    }
                    else if (parent.Parent.GetType() == typeof(ScrollView))
                    {
                        dropdownContentY -= ((ScrollView)parent.Parent).ScrollY;
                        parent            = null;
                    }
                }
            }
            if ((dropdownContentY + dropdownHeight) > Application.Current.MainPage.Height)
            {
                dropdownContentY -= (dropdownHeight + button.Height + 10);
            }

            await Task.Run(() =>
            {
                OverlayHelper.Open(dropdown, AbsoluteLayoutFlags.WidthProportional,
                                   new Rectangle(0, dropdownContentY, 1, dropdownHeight), Color.FromHex("#00000000"));
            });
        }
Esempio n. 6
0
 protected override void OnAppearing()
 {
     base.OnAppearing();
     OverlayHelper.AdjustView();
 }
Esempio n. 7
0
 private void OK_Clicked(object sender, System.EventArgs e)
 {
     OverlayHelper.Close();
 }
Esempio n. 8
0
 private void newLayerClicked(object sender, System.EventArgs e)
 {
     OverlayHelper.Open(new ExamplePopup3(), AbsoluteLayoutFlags.All,
                        new Rectangle(0, 0.5, 1, 0.3), Color.FromHex("#88000000"));
 }