/// <summary> /// Constructor to initialize all stuff /// </summary> /// <param name="aConfiguration">Reference to the the Configuration object</param> public Settings(Configuration aConfiguration, IPluginManager aPluginManager) { _myConfiguration = aConfiguration; _myConfiguration.AddObserver(this); _pluginManager = aPluginManager; _converter = new System.Windows.Forms.KeysConverter(); _cultConvert = new CultureInfoConverter(); InitializeComponent(); WriteThanks(); }
/// <summary> /// Constructor for Main Window /// - Init Visualisation /// - Text Scrolling /// - Add Event Handlers /// - Apply a Skin /// - Initialize Tray Icon /// </summary> /// <param name="appHandle"></param> /// <param name="aConfiguration"></param> /// <param name="aPluginManager"></param> public Standard(App appHandle, Configuration aConfiguration, PluginManager.PluginManager aPluginManager) { _anAppHandle = appHandle; AConfiguration = aConfiguration; APluginManager = aPluginManager; _aVisualization = new Visualization(2048, VisTimerInMs); /*clockVis = new System.Windows.Threading.DispatcherTimer(); clockVis.Interval = new TimeSpan(0, 0, 0, 0, VisTimerInMs); clockVis.Tick += new EventHandler(ClockVisTick); */ _clockScrollingText = new DispatcherTimer { Interval = new TimeSpan(0, 0, 0, 0, ScrollSpeed) }; _clockScrollingText.Tick += ClockScrollingTextTick; _clockScrollingText.IsEnabled = true; _scrollDataArtist = new ScrollData(); _scrollDataAlbum = new ScrollData { ScrollWidthCorrection = -8 }; _scrollDataTitle = new ScrollData(); _currentHighlightedSong = -1; _changeSeekBarDragged = false; InitializeComponent(); _currentVis = 1; _insertFolder = false; // Initialise Click-Into BarHandlers changeSeekBar.AddHandler(PreviewMouseLeftButtonDownEvent, new RoutedEventHandler(ChangeSeekBarMouseLeftButtonDown), true); changeVolumeBar.AddHandler(PreviewMouseLeftButtonDownEvent, new RoutedEventHandler(ChangeVolumeBarMouseLeftButtonDown), true); changeBalance.AddHandler(PreviewMouseLeftButtonDownEvent, new RoutedEventHandler(changeBalanceSlide), true); sliderEQBand0.AddHandler(PreviewMouseLeftButtonDownEvent, new RoutedEventHandler(sliderEQBand_DragCompleted), true); sliderEQBand1.AddHandler(PreviewMouseLeftButtonDownEvent, new RoutedEventHandler(sliderEQBand_DragCompleted), true); sliderEQBand2.AddHandler(PreviewMouseLeftButtonDownEvent, new RoutedEventHandler(sliderEQBand_DragCompleted), true); sliderEQBand3.AddHandler(PreviewMouseLeftButtonDownEvent, new RoutedEventHandler(sliderEQBand_DragCompleted), true); sliderEQBand4.AddHandler(PreviewMouseLeftButtonDownEvent, new RoutedEventHandler(sliderEQBand_DragCompleted), true); sliderEQBand5.AddHandler(PreviewMouseLeftButtonDownEvent, new RoutedEventHandler(sliderEQBand_DragCompleted), true); sliderEQBand6.AddHandler(PreviewMouseLeftButtonDownEvent, new RoutedEventHandler(sliderEQBand_DragCompleted), true); sliderEQBand7.AddHandler(PreviewMouseLeftButtonDownEvent, new RoutedEventHandler(sliderEQBand_DragCompleted), true); sliderEQBand8.AddHandler(PreviewMouseLeftButtonDownEvent, new RoutedEventHandler(sliderEQBand_DragCompleted), true); sliderEQBand9.AddHandler(PreviewMouseLeftButtonDownEvent, new RoutedEventHandler(sliderEQBand_DragCompleted), true); //Trayiconstuff _componentForTray = new Container(); _notifyIcon1 = new NotifyIcon(_componentForTray); //Apply skin _currentSkin = aConfiguration.UsedSkin; ApplySkin(_currentSkin); //Gamnoise Plugin _dictPluginWindows = new Dictionary<string, Plugin>(); InitPlugins(); }
/// <summary> /// Initialize the local variables /// </summary> /// <param name="aConfiguration">The Configuration</param> /// <param name="appHandle">Handler of the Root-Window</param> public Ingame(Configuration aConfiguration, App appHandle) { _anAppHandle = appHandle; _myConfiguration = aConfiguration; _time = 0; _totaltime = 0; _artist = ""; _title = ""; _hotkeyPause = "Space"; _hotkeyPrev = "P"; _hotkeyNext = "N"; _hotkeyStop = "Return"; _hotkeyVolumeUp = "+"; _hotkeyVolumeDown = "-"; _hotkeyHide = "O"; _colorBackground = Color.FromArgb(255, _myConfiguration.OverlayColorBack.Red, _myConfiguration.OverlayColorBack.Green, _myConfiguration.OverlayColorBack.Blue); _colorHotkeyTop = Color.FromArgb(255, _myConfiguration.OverlayColorHKTop.Red, _myConfiguration.OverlayColorHKTop.Green, _myConfiguration.OverlayColorHKTop.Blue); _colorHotkeyBackground = Color.FromArgb(255, _myConfiguration.OverlayColorHKBack.Red, _myConfiguration.OverlayColorHKBack.Green, _myConfiguration.OverlayColorHKBack.Blue); _colorLines = Color.FromArgb(255, _myConfiguration.OverlayColorLine.Red, _myConfiguration.OverlayColorLine.Green, _myConfiguration.OverlayColorLine.Blue); _colorFont = Color.FromArgb(255, _myConfiguration.OverlayColorFont.Red, _myConfiguration.OverlayColorFont.Green, _myConfiguration.OverlayColorFont.Blue); _colorProgress = Color.FromArgb(255, _myConfiguration.OverlayColorProgress.Red, _myConfiguration.OverlayColorProgress.Green, _myConfiguration.OverlayColorProgress.Blue); _visible = false; _updating = false; try { MyOverlay = new Overlay {Size = new Size(OverlayWidth, OverlayHeight)}; _overlayPosition = _myConfiguration.OverlayPosition; SetPosition(_overlayPosition); //Initialize the Overlay InitOverlay(); } catch(Exception) {} }
/// <summary> /// This Method is loading the Configuration Files from your Home Dir and returns them /// </summary> /// <returns>Configuration Settings</returns> private static Configuration LoadSettings() { Configuration myConfig; try { // Construct an instance of the XmlSerializer with the type // of object that is being deserialized. XmlSerializer mySerializer = new XmlSerializer(typeof(Configuration)); // To read the file, create a FileStream. FileStream myFileStream = new FileStream(Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "\\Gamenoise\\settings.xml", FileMode.Open); // Call the Deserialize method and cast to the object type. myConfig = (Configuration) mySerializer.Deserialize(myFileStream); } catch(Exception) { myConfig = new Configuration(); } myConfig.Init(); return myConfig; }
/* private void Button_Click(object sender, RoutedEventArgs e) { pluginCanvas.Children.Clear(); this.Close(); } */ /// <summary> /// Apply a skin to the form /// </summary> /// <param name="skinName">Name of the skin</param> /// <param name="aConfiguration"></param> /// <param name="anAppHandle"></param> public void ApplyPluginSkin(String skinName, Configuration aConfiguration, App anAppHandle) { //Catch all current styles Collection<ResourceDictionary> mergedDicts = Resources.MergedDictionaries; // Remove the existing skin dictionary, if one exists. if (mergedDicts.Count > 0) { //Everytime clearing the Dictionary the exception will occur //But the skins will be cleared anyway try { mergedDicts.Clear(); } catch (InvalidOperationException) { } } try { //Get all files in the directory string[] files = Directory.GetFiles(aConfiguration.GetPluginPath() + _aPlugin.Name + "/Skins/" + skinName); foreach (string f in files) { //Check for invalid files if (!f.EndsWith(".xaml")) continue; if (f.IndexOf('~') != -1) continue; //create Stream StreamReader sReader = new StreamReader(f); //Crating a ResourceDictionary of the stream ResourceDictionary skinDict = XamlReader.Load(sReader.BaseStream) as ResourceDictionary; // Add the new Dictionary mergedDicts.Add(skinDict); } } catch (DirectoryNotFoundException) { // Use FallBackSkin if the current skin is in the plugin not available if (skinName != aConfiguration.getFallBackSkin()) { ApplyPluginSkin(aConfiguration.getFallBackSkin(), aConfiguration, anAppHandle); } else { new Error("Skin Dictionary Missing", false, null); } } catch (FileNotFoundException) { new Error("Skin File Missing", false, null); } catch (PathTooLongException) { new Error("Skin Path too long", false, null); } catch (ArgumentNullException) { new Error("Null Argument in ApplyPluginSkin", false, null); } catch (ArgumentException) { new Error("Wrong Argument in ApplyPluginSkin", false, null); } catch (IOException) { new Error("IO Error in ApplyPluginSkin", false, null); } catch (UnauthorizedAccessException) { new Error("Unauthorized Access in ApplyPluginSkin", false, null); } }
public void SetConfiguration(Configuration config) { _myConfig = config; }
public ConfigOverlayColor(Configuration config) { InitValues(); _myConfig = config; }
/// <summary> /// Second destructor if no xml-file is available /// </summary> /// <param name="config">Configuration object</param> public ConfigHotKey(Configuration config) { InitValues(); _myConfig = config; }