public HelperLinnSetup(string[] aArgs) : base(aArgs) { // create icons if (!IsWindows) { // mono can't currently handle layered icons, so don't load true icon, just use logo (image file) iIcon = Icon.FromHandle(Linn.Toolkit.WinForms.Properties.Resources.LinnLogo.GetHicon()); } else { try { // attempt to load icon from resource file iIcon = Linn.Toolkit.WinForms.Properties.Resources.Icon; } catch { // load icon file from disc instead - try the default installer location string fullpath = Path.GetFullPath(Path.Combine(Application.StartupPath, "linn.ico")); if (File.Exists(fullpath)) { iIcon = new Icon(fullpath); } else { // load icon file from disc instead - try the default build location fullpath = Path.GetFullPath(Path.Combine(Application.StartupPath, "../share/Linn/Core/linn.ico")); if (File.Exists(fullpath)) { iIcon = new Icon(fullpath); } else { // default to logo (image file) if no icon file can be found iIcon = Icon.FromHandle(Linn.Toolkit.WinForms.Properties.Resources.LinnLogo.GetHicon()); } } } } Size smallIconSize = new Size(16, 16); try { smallIconSize = SystemInformation.SmallIconSize; } catch { // not supported for all platforms } iSmallIcon = new Icon(iIcon, smallIconSize); iWarningIcon = Icon.FromHandle(Linn.Toolkit.WinForms.Properties.Resources.Warning.GetHicon()); // add application specific user options iOptionPageUpdates = new OptionPageUpdates(this); iApplicationOptions = new ApplicationOptions(this); AddOptionPage(iOptionPageUpdates); }
private void Initialise(IHelper aHelper, IViewAutoUpdate aView, IInvoker aInvoker, EventHandler <EventArgs> aUpdateStarted) { // create the auto updater // set it to look for stable releases to start with // option page will event what releases to look for once saved option has been parsed iAutoUpdate = new AutoUpdate(aHelper, AutoUpdate.kDefaultFeedLocation, 1000 * 60 * 60, AutoUpdate.EUpdateType.Stable, 1); // create the option page iOptionPageUpdates = new OptionPageUpdates(aHelper); iOptionPageUpdates.EventChanged += OptionPageUpdatesChanged; aHelper.AddOptionPage(iOptionPageUpdates); // create the controller iAutoUpdateController = new AutoUpdateController(aHelper, iAutoUpdate, iOptionPageUpdates, aView, aInvoker); iAutoUpdateController.EventUpdateStarted += aUpdateStarted; }
public HelperKinskyJukebox(string[] aArgs) : base(aArgs) { iHttpServer = new HttpServer(HttpServer.kPortKinskyJukebox); // add application specific user options iOptionPageSetup = new OptionPageSetup(this); iOptionPageOrganisation = new OptionPageOrganisation(); iOptionPageWizard = new OptionPageWizard(); iOptionPageUpdates = new OptionPageUpdates(this); iApplicationOptions = new ApplicationOptions(this); AddOptionPage(iOptionPageSetup); AddOptionPage(iOptionPageOrganisation); AddOptionPage(iOptionPageWizard); AddOptionPage(iOptionPageUpdates); Stack.SetStack(this); }
public PreferenceBindings(Model aModel, OptionPageUpdates aOptionPageUpdates) { iModel = aModel; iOptionPageUpdates = aOptionPageUpdates; iPreferences = iModel.Preferences; iReceiverList = new BindingList <ReceiverBinding>(new ReceiverEqualityComparer(), new ReceiverSortComparer()); iSubnetList = new BindingList <SubnetBinding>(new SubnetEqualityComparer(), new SubnetSortComparer()); iOptionPageUpdates.EventAutoUpdateChanged += OptionAutoUpdateChanged; // hook event handlers from model events iModel.EventEnabledChanged += ModelEnabledChanged; iModel.EventReceiverListChanged += ModelReceiverListChanged; iModel.EventSubnetListChanged += ModelSubnetListChanged; // hook event handlers from preferences events - these preferences can be changed by the // model - all other preferences can only be changed by this class so no need to handle events iPreferences.EventSelectedReceiverChanged += PreferencesSelectedReceiverChanged; iPreferences.EventSelectedSubnetChanged += PreferencesSelectedSubnetChanged; }
public AutoUpdateController(IHelper aHelper, AutoUpdate aAutoUpdate, OptionPageUpdates aOptionPageUpdates, IViewAutoUpdate aView, IInvoker aInvoker) { iAutoUpdate = aAutoUpdate; iOptionPageUpdates = aOptionPageUpdates; iView = aView; iInvoker = aInvoker; iModel = new AutoUpdateModel(aHelper.Title); iAutoUpdate.EventUpdateProgress += UpdateProgress; iAutoUpdate.EventUpdateFailed += UpdateFailed; iAutoUpdate.EventUpdateFound += UpdateFound; iOptionPageUpdates.EventAutoUpdateChanged += AutoUpdateChanged; iView.EventClosed += ViewClosed; iView.EventButtonUpdateClicked += ButtonUpdateClicked; iView.EventButtonAutoCheckClicked += ButtonAutoCheckClicked; AutoUpdateChanged(this, EventArgs.Empty); }
internal void InitialiseStack() { OptionPage generalOptionsPage = new OptionPage("General"); iHideCursorOption = new OptionBool("hidecursor", "Hide Cursor", "Hide Cursor", false); generalOptionsPage.Add(iHideCursorOption); iRotaryControlsOption = new OptionBool("rotarycontrol", "Use rotary controls", "Use rotary controls", true); generalOptionsPage.Add(iRotaryControlsOption); iShowToolTipsOption = new OptionBool("tooltips", "Show tooltips", "Show tooltips", true); generalOptionsPage.Add(iShowToolTipsOption); iShowExtendedTrackInfoOption = new OptionBool("trackinfo", "Extended track info", "Show extended track information", true); generalOptionsPage.Add(iShowExtendedTrackInfoOption); iGroupPlaylistOption = new OptionBool("groupplaylist", "Group playlist items by album", "Allows grouping of items within the playlist window", false); generalOptionsPage.Add(iGroupPlaylistOption); iTransparentOption = new OptionBool("customwindow", "Transparent window (requires restart)", "Toggles custom window", true); generalOptionsPage.Add(iTransparentOption); iSoftwareRenderingOption = new OptionBool("softwarerendering", "Force software rendering (requires restart)", "Disables hardware rendering for troublesome display cards", false); generalOptionsPage.Add(iSoftwareRenderingOption); iHelper.AddOptionPage(generalOptionsPage); iOptionPageUpdates = new OptionPageUpdates(iHelper); iHelper.AddOptionPage(iOptionPageUpdates); OptionPage fontsOptionPage = new OptionPage("Fonts"); iFontsOption = new OptionEnum("fontsize", "Font size", "Font size"); iFontsOption.AddDefault(kFontOptionNormal); iFontsOption.Add(kFontOptionLarge); fontsOptionPage.Add(iFontsOption); iHideCursorOption.EventValueChanged += OnOptionChanged; iRotaryControlsOption.EventValueChanged += OnOptionChanged; iShowToolTipsOption.EventValueChanged += OnOptionChanged; iShowExtendedTrackInfoOption.EventValueChanged += OnOptionChanged; iFontsOption.EventValueChanged += OnOptionChanged; iTransparentOption.EventValueChanged += OnOptionChanged; iOptionPageUpdates.EventBetaVersionsChanged += OnUpdatesChanged; iOptionPageUpdates.EventAutoUpdateChanged += OnUpdatesChanged; iHelper.AddOptionPage(fontsOptionPage); iViewMaster = new ViewMaster(); iHttpServer = new HttpServer(HttpServer.kPortKinskyDesktop); iHttpClient = new HttpClient(); iLibrary = new MediaProviderLibrary(iHelper); iSharedPlaylists = new SharedPlaylists(iHelper); iLocalPlaylists = new LocalPlaylists(iHelper, true); iSupport = new MediaProviderSupport(iHttpServer); PluginManager pluginManager = new PluginManager(iHelper, iHttpClient, iSupport); iLocator = new ContentDirectoryLocator(pluginManager, new AppRestartHandler()); OptionBool optionSharedPlaylists = iLocator.Add(SharedPlaylists.kRootId, iSharedPlaylists); OptionBool optionLocalPlaylists = iLocator.Add(LocalPlaylists.kRootId, iLocalPlaylists); iLocator.Add(MediaProviderLibrary.kLibraryId, iLibrary); iHelper.AddOptionPage(iLocator.OptionPage); iSaveSupport = new SaveSupport(iHelper, iSharedPlaylists, optionSharedPlaylists, iLocalPlaylists, optionLocalPlaylists); iViewSaveSupport = new ViewSaveSupport(RequestLocalPlaylistFilename, iSaveSupport); iPlaySupport = new PlaySupport(); iHelper.ProcessOptionsFileAndCommandLine(); SetUpdateTypes(); }
public HelperKinskyDesktop(string[] aArgs, Rect aScreenRect, IInvoker aInvoker) : base(aArgs, aInvoker) { float goldenRatio = 0.6180339887f; float windowWidth = aScreenRect.Width * goldenRatio; float windowHeight = windowWidth * goldenRatio; iOptionPageGeneral = new OptionPageGeneral("General"); AddOptionPage(iOptionPageGeneral); iOptionWindowX = new OptionFloat("windowx", "WindowX", "Main window's x position", aScreenRect.Origin.X + (aScreenRect.Width - windowWidth) * 0.5f); AddOption(iOptionWindowX); iOptionWindowY = new OptionFloat("windowy", "WindowY", "Main window's y position", aScreenRect.Origin.Y + (aScreenRect.Height - windowHeight) * 0.5f); AddOption(iOptionWindowY); iOptionWindowWidth = new OptionFloat("windowwidth", "WindowWidth", "Main window's width", windowWidth); AddOption(iOptionWindowWidth); iOptionWindowHeight = new OptionFloat("windowheight", "WindowHeight", "Main window's height", windowHeight); AddOption(iOptionWindowHeight); iOptionSplitterFraction = new OptionFloat("splitterfraction", "SplitterFraction", "Splitter position in range [0, 1]", goldenRatio); AddOption(iOptionSplitterFraction); iOptionFullscreen = new OptionBool("fullscreen", "Fullscreen", "Fullscreen mode", false); AddOption(iOptionFullscreen); iOptionKompactMode = new OptionBool("kompactmode", "KompactMode", "Kompact mode", false); AddOption(iOptionKompactMode); iOptionContainerView = new OptionUint("containerview", "ContainerView", "Container View", 0); AddOption(iOptionContainerView); iOptionContainerSizeThumbs = new OptionFloat("containersizethumbs", "ContainerSizeThumbs", "Image size for browser thumbnail view", 0.3f); AddOption(iOptionContainerSizeThumbs); iOptionContainerSizeList = new OptionFloat("containersizelist", "ContainerSizeList", "Image size for browser list view", 0.3f); AddOption(iOptionContainerSizeList); iOptionPageUpdates = new OptionPageUpdates(this); AddOptionPage(iOptionPageUpdates); // check for valid window coordinates - reset to defaults if: // - the window width is greater than 1.5 times the screen width OR // - the window height is greater than 1.5 times the screen height OR // - the window rect does not intersect the screen rect if (iOptionWindowWidth.Native > 1.5f * aScreenRect.Width || iOptionWindowHeight.Native > 1.5f * aScreenRect.Height || !aScreenRect.Intersects(new Rect(iOptionWindowX.Native, iOptionWindowY.Native, iOptionWindowWidth.Native, iOptionWindowHeight.Native))) { iOptionWindowX.ResetToDefault(); iOptionWindowY.ResetToDefault(); iOptionWindowWidth.ResetToDefault(); iOptionWindowHeight.ResetToDefault(); } // check validity of other options if (iOptionSplitterFraction.Native < 0.0f || iOptionSplitterFraction.Native > 1.0f) { iOptionSplitterFraction.ResetToDefault(); } if (iOptionContainerSizeThumbs.Native < 0.0f || iOptionContainerSizeThumbs.Native > 1.0f) { iOptionContainerSizeThumbs.ResetToDefault(); } if (iOptionContainerSizeList.Native < 0.0f || iOptionContainerSizeList.Native > 1.0f) { iOptionContainerSizeList.ResetToDefault(); } }