Esempio n. 1
0
 private void ShowBlocksButton_Clicked(object sender, EventArgs e)
 {
     if (AmbilightConfigNamePicker.SelectedItem.ToString() == "None")
     {
         MainMenu.SendData("AMBILIGHT(False,False,True,False,)$");
     }
     else
     {
         MainMenu.SendData("AMBILIGHT(False,False,True,False," + AmbilightConfigNamePicker.SelectedItem + ")$");
     }
 }
Esempio n. 2
0
        private void ConnectButtonClicked(object sender, EventArgs e)
        {
            if (IpEntry.Text != null && PortEntry.Text != null)
            {
                try
                {
                    if (MenuPage.SourceApp.Client.Client.Connected)
                    {
                        MenuPage.SourceApp.Client.Client.Close();
                    }

                    MenuPage.IPAddress        = IPAddress.Parse(IpEntry.Text);
                    MenuPage.PortNumber       = Int32.Parse(PortEntry.Text);
                    MenuPage.SourceApp.Client = new TcpClient();

                    var result = MenuPage.SourceApp.Client.BeginConnect(MenuPage.IPAddress, MenuPage.PortNumber, null, null);

                    var success = result.AsyncWaitHandle.WaitOne(TimeSpan.FromSeconds(1));

                    if (!success)
                    {
                        DisplayAlert("Error", "Failed to connect to ip: " + MenuPage.IPAddress + ":" + MenuPage.PortNumber, "OK");
                        throw new Exception("Failed to connect.");
                    }

                    MenuPage.SourceApp.Client.EndConnect(result);

                    UserSettings.ConnectionSettingsDefaultIP   = IpEntry.Text;
                    UserSettings.ConnectionSettingsDefaultPort = Int32.Parse(PortEntry.Text);

                    MenuPage.ReceiveData();

                    MenuPage.SendData("GETTOTALLEDCOUNT()");
                    MenuPage.TotalLEDCount = Int32.Parse(MenuPage.ReceiveData());

                    MenuPage.SendData("GETSERVERNAME()");
                    MenuPage.ServerIDLabel.Text = "Connected to server: " + MenuPage.ReceiveData();

                    Application.Current.MainPage.Navigation.PopAsync();
                }
                catch
                {
                    Console.WriteLine("Error in input!");
                }
            }
        }
Esempio n. 3
0
 private void StartVisualizerButton_Clicked(object sender, EventArgs e)
 {
     if (VisualizerConfigNamePicker.SelectedItem.ToString() == "None")
     {
         MainMenu.SendData("VISUALIZER(True,False,)$");
     }
     else
     {
         MainMenu.SendData("VISUALIZER(True,False," + VisualizerConfigNamePicker.SelectedItem + ")$");
     }
 }
        public AnimationSettingsPage(MainMenuPage _MainMenu)
        {
            InitializeComponent();
            MainMenu = _MainMenu;

            MainMenu.SendData("GETANIMATIONCONFIGS()");
            string Response = MainMenu.ReceiveData();

            AnimationConfigNamePicker.Items.Clear();
            AnimationConfigNamePicker.Items.Add("None");
            AnimationConfigNamePicker.SelectedIndex = 0;
            foreach (string Config in Response.Split(';'))
            {
                if (Config != "")
                {
                    AnimationConfigNamePicker.Items.Add(Config);
                }
            }
        }
Esempio n. 5
0
        public InstructionsPage(MainMenuPage _MainMenu)
        {
            InitializeComponent();
            MainMenu = _MainMenu;

            MainMenu.SendData("GETINSTRUCTIONSCONFIGS()");
            string Response = MainMenu.ReceiveData();

            InstructionsConfigNamePicker.Items.Clear();
            InstructionsConfigNamePicker.Items.Add("None");
            InstructionsConfigNamePicker.SelectedIndex = 0;
            foreach (string Config in Response.Split(';'))
            {
                if (Config != "")
                {
                    InstructionsConfigNamePicker.Items.Add(Config);
                }
            }
        }
Esempio n. 6
0
 private void SetColorsButton_Clicked(object sender, EventArgs e)
 {
     if (MainMenu.SourceApp.Client.Connected)
     {
         try
         {
             MainMenu.SendData("INDIVIDUALCOLOR(" +
                               Math.Round(Convert.ToDecimal(PinIDEntry.Text), 0) + "," +
                               Math.Round(Convert.ToDecimal(HardwareIDEntry.Text), 0) + "," +
                               Math.Round(SingleRedSlider.Value, 0) + "," +
                               Math.Round(SingleGreenSlider.Value, 0) + "," +
                               Math.Round(SingleBlueSlider.Value, 0) + ")");
         }
         catch
         {
             Console.WriteLine("Error in transmitting!");
         }
     }
 }
Esempio n. 7
0
        public VisualizerSettingsPage(MainMenuPage _MainMenu)
        {
            InitializeComponent();
            MainMenu = _MainMenu;

            MainMenu.SendData("GETVISUALIZERCONFIGS()$");
            string Response = MainMenu.ReceiveData();

            VisualizerConfigNamePicker.Items.Clear();
            VisualizerConfigNamePicker.Items.Add("None");
            VisualizerConfigNamePicker.SelectedIndex = 0;
            foreach (string Config in Response.Split(';'))
            {
                if (Config != "")
                {
                    VisualizerConfigNamePicker.Items.Add(Config);
                }
            }
        }
Esempio n. 8
0
 private void FadeColorsButton_Clicked(object sender, EventArgs e)
 {
     if (MainMenu.SourceApp.Client.Connected)
     {
         try
         {
             MainMenu.SendData("FADECOLOR(False, " +
                               Math.Round(Convert.ToDecimal(FromIDPicker.SelectedItem), 0) + "," +
                               Math.Round(Convert.ToDecimal(ToIDPicker.SelectedItem), 0) + "," +
                               Math.Round(RedSlider.Value, 0) + "," +
                               Math.Round(GreenSlider.Value, 0) + "," +
                               Math.Round(BlueSlider.Value, 0) + "," +
                               Math.Round(Convert.ToDecimal(FadeSpeedPicker.SelectedItem), 0) + "," +
                               Convert.ToDecimal(FadeFactorPicker.SelectedItem).ToString().Replace(',', '.') + ")");
         }
         catch
         {
             Console.WriteLine("Error in transmitting!");
         }
     }
 }
Esempio n. 9
0
        public AmbilightSettingsPage(MainMenuPage _MainMenu)
        {
            InitializeComponent();

            MainMenu = _MainMenu;

            MainMenu.SendData("GETAMBILIGHTCONFIGS()");
            string Response = MainMenu.ReceiveData();

            AmbilightConfigNamePicker.Items.Clear();
            AmbilightConfigNamePicker.Items.Add("None");
            AmbilightConfigNamePicker.SelectedIndex = 0;
            foreach (string Config in Response.Split(';'))
            {
                if (Config != "")
                {
                    AmbilightConfigNamePicker.Items.Add(Config);
                }
            }
            AmbilightConfigNamePicker.Items.RemoveAt(AmbilightConfigNamePicker.Items.Count - 1);
        }
Esempio n. 10
0
 private void AnimationLoopSwitch_Switch(object sender, EventArgs e)
 {
     MainMenu.SendData("ANIMATION(False,False," + AnimationLoopSwitch.IsToggled + ",)$");
 }
Esempio n. 11
0
 private void InstructionsLoopSwitch_Switch(object sender, EventArgs e)
 {
     MainMenu.SendData("INSTRUCTIONS(False,False," + InstructionsLoopSwitch.IsToggled + ",)$");
 }
Esempio n. 12
0
        public FadeColorsPage(MainMenuPage _MainMenu)
        {
            InitializeComponent();
            MainMenu = _MainMenu;

            FadeSpeedPicker.Items.Clear();
            FadeFactorPicker.Items.Clear();
            FromIDPicker.Items.Clear();
            ToIDPicker.Items.Clear();

            for (int i = 0; i < 100; i++)
            {
                FadeSpeedPicker.Items.Add(i.ToString());
            }

            for (double i = 0; i <= 1; i += 0.05)
            {
                FadeFactorPicker.Items.Add(i.ToString());
            }

            for (int i = 0; i < MainMenu.TotalLEDCount; i++)
            {
                FromIDPicker.Items.Add(i.ToString());
            }

            for (int i = -1; i < MainMenu.TotalLEDCount; i++)
            {
                ToIDPicker.Items.Add(i.ToString());
            }

            MainMenu.SendData("GETTRACKBARVALUE(FadeColorsRedTrackBar,0)");
            RedSlider.Value = Convert.ToDouble(MainMenu.ReceiveData());
            MainMenu.SendData("GETTRACKBARVALUE(FadeColorsGreenTrackBar,0)");
            GreenSlider.Value = Convert.ToDouble(MainMenu.ReceiveData());
            MainMenu.SendData("GETTRACKBARVALUE(FadeColorsBlueTrackBar,0)");
            BlueSlider.Value = Convert.ToDouble(MainMenu.ReceiveData());
            MainMenu.SendData("GETCONTROLTEXT(FadeColorsFadeSpeedNumericUpDown,0)");
            string Recived = MainMenu.ReceiveData();

            for (int i = 0; i < FadeSpeedPicker.Items.Count; i++)
            {
                if (FadeSpeedPicker.Items[i].ToString() == Recived)
                {
                    FadeSpeedPicker.SelectedIndex = i;
                    break;
                }
            }
            MainMenu.SendData("GETCONTROLTEXT(FadeColorsFadeFactorNumericUpDown,0)");
            Recived = MainMenu.ReceiveData();
            for (int i = 0; i < FadeFactorPicker.Items.Count; i++)
            {
                if (Convert.ToDouble(FadeFactorPicker.Items[i].ToString().Replace(',', '.')) == Convert.ToDouble(Recived.Replace(',', '.')))
                {
                    FadeFactorPicker.SelectedIndex = i;
                    break;
                }
                else
                if (Convert.ToDouble(FadeFactorPicker.Items[i].ToString().Replace('.', ',')) == Convert.ToDouble(Recived.Replace('.', ',')))
                {
                    FadeFactorPicker.SelectedIndex = i;
                    break;
                }
            }
            MainMenu.SendData("GETCONTROLTEXT(FadeLEDPanelFromIDNumericUpDown,0)");
            Recived = MainMenu.ReceiveData();
            for (int i = 0; i < FromIDPicker.Items.Count; i++)
            {
                if (FromIDPicker.Items[i].ToString() == Recived)
                {
                    FromIDPicker.SelectedIndex = i;
                    break;
                }
            }
            MainMenu.SendData("GETCONTROLTEXT(FadeLEDPanelToIDNumericUpDown,0)");
            Recived = MainMenu.ReceiveData();
            for (int i = 0; i < ToIDPicker.Items.Count; i++)
            {
                if (ToIDPicker.Items[i].ToString() == Recived)
                {
                    ToIDPicker.SelectedIndex = i;
                    break;
                }
            }

            RedSliderValueLabel.Text   = Math.Round(RedSlider.Value, 0).ToString();
            GreenSliderValueLabel.Text = Math.Round(GreenSlider.Value, 0).ToString();
            BlueSliderValueLabel.Text  = Math.Round(BlueSlider.Value, 0).ToString();

            Loading = false;
        }