Ejemplo n.º 1
0
        private void MoreButton_Click(object sender, RoutedEventArgs e)
        {
            var senderElement  = sender as FrameworkElement;
            var particleDevice = (ParticleDevice)senderElement.DataContext;

            var reFlashTinkerMenuButton = (MenuFlyoutItem)FindName("ReFlashTinkerMenuButton");

            reFlashTinkerMenuButton.Visibility = TinkerData.CanFlashTinker(particleDevice) ? Visibility.Visible : Visibility.Collapsed;

            DeviceFlyout.ShowAt(senderElement);
        }
Ejemplo n.º 2
0
        private async void LoginButton_Click(object sender, RoutedEventArgs e)
        {
            ResourceLoader resourceLoader = new ResourceLoader();

            EmailError.Visibility    = Visibility.Collapsed;
            PasswordError.Visibility = Visibility.Collapsed;
            ErrorBorder.Visibility   = Visibility.Collapsed;

            string errorText = "";
            var    email     = Email.Text;
            var    password  = Password.Password;

            if (string.IsNullOrWhiteSpace(email))
            {
                errorText            += resourceLoader.GetString("ErrorEmailIsRequired");
                EmailError.Visibility = Visibility.Visible;
            }
            if (string.IsNullOrWhiteSpace(password))
            {
                if (errorText.Length != 0)
                {
                    errorText += "\n";
                }
                errorText += resourceLoader.GetString("ErrorPasswordIsRequired");
                PasswordError.Visibility = Visibility.Visible;
            }

            if (errorText.Length != 0)
            {
                ErrorText.Text         = errorText;
                ErrorBorder.Visibility = Visibility.Visible;
                return;
            }

            SetEnableState(false);

            var success = await ParticleCloud.SharedCloud.LoginAsync(email, password);

            if (success)
            {
                TinkerData.Login();
                Frame.Navigate(typeof(DevicesPage));
            }
            else
            {
                ErrorText.Text         = resourceLoader.GetString("AuthCredentialsError");
                ErrorBorder.Visibility = Visibility.Visible;
            }

            SetEnableState(true);
        }
        private void ShowDeviceMenu(object sender)
        {
            var senderElement  = sender as FrameworkElement;
            var particleDevice = (ParticleDevice)senderElement.DataContext;

            var deviceFlyout = (MenuFlyout)Resources["DeviceFlyout"];

            var reFlashTinkerMenuButton = (MenuFlyoutItem)FindName("ReFlashTinkerMenuButton");

            reFlashTinkerMenuButton.Visibility = TinkerData.CanFlashTinker(particleDevice) ? Visibility.Visible : Visibility.Collapsed;

            AdjustFlyoutMargin(deviceFlyout);

            deviceFlyout.ShowAt(senderElement);
        }
Ejemplo n.º 4
0
        private void LoadPins()
        {
            if (!TinkerData.HasShownWelcomeToTinker)
            {
                WelcomToTinkerGrid.Visibility = Visibility.Visible;
                ApplicationData.Current.LocalSettings.Values["WelcomeToTinker"] = true;
            }

            var devicePinActions = TinkerData.GetDevicePinActions(particleDevice.Id);

            ResourceLoader resourceLoader = new ResourceLoader();

            analogPinWriteCaption = resourceLoader.GetString("AnalogPinWriteCaption");

            pins = Pin.GetDevicePins(particleDevice);

            foreach (var pin in pins)
            {
                if (devicePinActions.ContainsKey(pin.TinkerId))
                {
                    pin.ConfiguredAction = devicePinActions[pin.TinkerId];
                }

                var pinButton = (PinButton)FindName(pin.TinkerId);
                pinButton.DataContext = pin;
                pinButton.Tapped     += PinButton_Tapped;
                pinButton.Holding    += PinButton_Holding;

                if (pin.PinType == PinType.B || pin.PinType == PinType.C)
                {
                    LowerPinGrid.Visibility = Visibility.Visible;
                }
            }

            var pinButtons = FlyoutHelper.FindTypeInContainer <PinButton>((DependencyObject)PinScrollViewer.Content);

            foreach (var pinButton in pinButtons)
            {
                if (pinButton.DataContext.GetType() != typeof(Pin))
                {
                    pinButton.Visibility = Visibility.Collapsed;
                }
            }
        }
Ejemplo n.º 5
0
        public override void Stock(GameObject GO, string Context = null)
        {
            GO.TakeObject(TinkerData.createDataDisk("Autovalet"), true, 0);
            GO.TakeObject(TinkerData.createDataDisk("mod:acegiak_ModTreaded"), true, 0);
            GO.TakeObject(TinkerData.createDataDisk("mod:acegiak_ModHandy"), true, 0);
            GO.TakeObject(TinkerData.createDataDisk("mod:acegiak_ModAwoken"), true, 0);
            GO.TakeObject(TinkerData.createDataDisk("mod:acegiak_ModPlated"), true, 0);
            int i = 0;

            for (int num = Stat.Random(5, 7); i < num; i++)
            {
                GO.TakeObject(EncounterFactory.Factory.RollOneFromTable("Scrap 1", Context), true, 0);
            }
            int j = 0;

            for (int num2 = Stat.Random(5, 7); j < num2; j++)
            {
                GO.TakeObject(EncounterFactory.Factory.RollOneFromTable("Scrap 2", Context), true, 0);
            }
            int k = 0;

            for (int num3 = Stat.Random(5, 7); k < num3; k++)
            {
                GO.TakeObject(EncounterFactory.Factory.RollOneFromTable("Scrap 3", Context), true, 0);
            }
            int l = 0;

            for (int num4 = Stat.Random(5, 7); l < num4; l++)
            {
                GO.TakeObject(EncounterFactory.Factory.RollOneFromTable("Scrap 4", Context), true, 0);
            }
            int m = 0;

            for (int num5 = Stat.Random(1, 2); m < num5; m++)
            {
                GO.TakeObject(GameObject.create("DataDisk", Context), true, 0);
            }
            int n = 0;

            for (int num6 = Stat.Random(3, 5); n < num6; n++)
            {
                GO.TakeObject(GameObject.create("Waterskin", Context), true, 0);
            }
        }
        private async void LoginButton_Click(object sender, RoutedEventArgs e)
        {
            ResourceLoader resourceLoader = new ResourceLoader();

            TokenError.Visibility  = Visibility.Collapsed;
            ErrorBorder.Visibility = Visibility.Collapsed;

            string errorText = "";
            var    token     = Token.Text;

            if (string.IsNullOrWhiteSpace(token))
            {
                errorText            += resourceLoader.GetString("ErrorTokenIsRequired");
                TokenError.Visibility = Visibility.Visible;
            }

            if (errorText.Length != 0)
            {
                ErrorText.Text         = errorText;
                ErrorBorder.Visibility = Visibility.Visible;
                return;
            }

            SetEnableState(false);

            var success = await ParticleCloud.SharedCloud.TokenLoginAsync(token);

            if (success)
            {
                TinkerData.Login();
                Frame.Navigate(typeof(DevicesPage));
            }
            else
            {
                ErrorText.Text         = resourceLoader.GetString("AuthCredentialsError");
                ErrorBorder.Visibility = Visibility.Visible;
            }

            SetEnableState(true);
        }
        private void LaunchSoftAP()
        {
            UI.WindowsRuntimeResourceManager.InjectIntoResxGeneratedApplicationResourcesClass(typeof(Particle.Setup.SetupResources));

            SoftAPSettings softAPSettings = new SoftAPSettings();

            softAPSettings.AppFrame           = Frame;
            softAPSettings.CompletionPageType = GetType();
            softAPSettings.Username           = TinkerData.Username;
            softAPSettings.CurrentDeviceNames = TinkerData.GetDeviceNames();
            softAPSettings.OnSoftAPExit      += SoftAPSettings_OnSoftAPExit;

#if WINDOWS_PHONE_APP
            hardwareButtonsBackPressed = new EventHandler <Windows.Phone.UI.Input.BackPressedEventArgs>(delegate(object sender, Windows.Phone.UI.Input.BackPressedEventArgs e)
            {
                e.Handled = SoftAP.BackButtonPressed();
            });

            Windows.Phone.UI.Input.HardwareButtons.BackPressed += hardwareButtonsBackPressed;
#endif

            SoftAP.Start(softAPSettings);
        }
Ejemplo n.º 8
0
 private void SavePinState(Pin pin)
 {
     TinkerData.SetDevicePinAction(particleDevice.Id, pin.TinkerId, pin.ConfiguredAction);
 }
 private void ParticleCloud_ClientUnauthorized()
 {
     TinkerData.Logout();
 }
 private void LogoutAppBarButton_click(object sender, RoutedEventArgs e)
 {
     TinkerData.Logout();
 }