private void UnselectBucket(BucketPosition pos) { SkeletonUtils.modifyUI( new ThreadStart(() => { try { boxes[(int)pos].Fill = new SolidColorBrush((getController(pos).getVolume() > 100) ? Colors.Green : Colors.White); progressBars[(int)pos].Value = getController(pos).getVolume(); } catch (Exception) { } })); }
private void enablerClick(BucketPosition pos) { if (allControllers[(int)pos] == null) { if (enable(pos)) { enablers[(int)pos].Background = new SolidColorBrush(Colors.Green); } } else { allControllers[(int)pos] = null; enablers[(int)pos].Background = new SolidColorBrush(Colors.Red); } }
private bool enable(BucketPosition pos) { String IP = Microsoft.VisualBasic.Interaction.InputBox("Enter the IP and Port Ex: 192.168.0.1:9999", "KPAT", defaultVLCIp + ":" + defaultVLCPort); String[] IPs = IP.Split(':'); if (IPs.Length != 2) { System.Windows.MessageBox.Show("Error - Invalid format", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return(false); } Match match = Regex.Match(IPs[0], @"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}"); if (!match.Success) { System.Windows.MessageBox.Show("Error - Invalid format", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return(false); } int port; bool isNumeric = int.TryParse(IPs[1], out port); if (!isNumeric || port <= 0) { System.Windows.MessageBox.Show("Error - Invalid format", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return(false); } // We now have a valid IP and port. try { VlcController newController = new VlcController(IPs[0], port); VlcController oldController = allControllers[(int)pos]; allControllers[(int)pos] = newController; if (oldController != null) { oldController.shutdown(); } } catch (Exception) { System.Windows.MessageBox.Show("Error - Could not connect to a vlc instance with the data provided", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return(false); } return(true); }
public void selectBucket(BucketPosition pos) { SkeletonUtils.modifyUI( new ThreadStart(() => { try { boxes[(int)pos].Fill = new SolidColorBrush(Colors.Cyan); } catch (Exception) { } })); System.Timers.Timer myTimer = new System.Timers.Timer(); myTimer.Elapsed += delegate { UnselectBucket(pos); }; myTimer.Interval = 1000; // 1s myTimer.Start(); }
public VlcController getController(BucketPosition pos) { return(allControllers[(int)pos]); }