Example #1
0
        public HelperKinskyTouch(IntPtr aInstance)
            : base(aInstance)
        {
            iHelper = new HelperKinsky(new string[] {}, new Invoker());

            UIDevice.CurrentDevice.BatteryMonitoringEnabled = true;
            NSNotificationCenter.DefaultCenter.AddObserver(UIDevice.BatteryStateDidChangeNotification, delegate {
                EventOptionAutoLockValueChanged(this, EventArgs.Empty);
            });

            iCrashLogDumper = new CrashLogDumper(iHelper.Title, iHelper.Product, iHelper.Version);
            iHelper.AddCrashLogDumper(iCrashLogDumper);

            iOptionPageGeneral = new OptionPageGeneral("General");
            iHelper.AddOptionPage(iOptionPageGeneral);

            iOptionInsertMode = new OptionInsertMode();
            iHelper.AddOption(iOptionInsertMode);

            iOptionPageGeneral.OptionAutoLock.EventValueChanged         += EventOptionAutoLockValueChanged;
            iOptionPageGeneral.OptionAutoSendCrashLog.EventValueChanged += EventOptionAutoSendCrashLogValueChanged;

            iHelper.ProcessOptionsFileAndCommandLine();

            EventOptionAutoLockValueChanged(this, EventArgs.Empty);
            EventOptionAutoSendCrashLogValueChanged(this, EventArgs.Empty);
        }
Example #2
0
        static void Main(string[] aArgs)
        {
            //Thread.CurrentThread.Priority = ThreadPriority.BelowNormal;

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            // ensure that all unhandled exceptions in this thread bypass the
            // Application class handlers and let the AppDomain handlers that
            // have been added in to the helper handle it
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.ThrowException);
            // create the application helper, adding a form based crash log dumper
            HelperKinsky    helper = new HelperKinsky(aArgs, new Invoker());
            ICrashLogDumper d      = new CrashLogDumperForm(helper.Title,
                                                            helper.Product,
                                                            helper.Version,
                                                            System.Drawing.Icon.FromHandle(Linn.Kinsky.Properties.Resources.KinskyLogo.GetHicon()));

            helper.AddCrashLogDumper(d);
            helper.ProcessOptionsFileAndCommandLine();


            Application.Run(new FormKinskyDesktop(helper));

            helper.Dispose();
        }
Example #3
0
        public KinskyDesktop()
        {
            iInstance = this;
            HttpWebRequest.DefaultWebProxy             = WebRequest.GetSystemWebProxy();
            HttpWebRequest.DefaultWebProxy.Credentials = CredentialCache.DefaultCredentials;
            iWindowLoaded = new AutoResetEvent(false);
            iImageCache   = new WpfImageCache(kCacheSize, kDownscaleImageSize, kThreadCount);
            iIconResolver = new IconResolver();
            ResourceDictionary dictionary   = App.Current.Resources;
            string             assemblyName = System.Reflection.Assembly.GetExecutingAssembly().FullName;

            string[] resourceDictionaries =
            {
                "Shared",
                "ControlStyles",
                "ScrollBar",
                "ComboBox",
                "ListBox",
                "TileViewStyle",
                "WindowChromeStyle",
                "MenuItem",
                "Slider"
            };

            foreach (string resourceDictionary in resourceDictionaries)
            {
                dictionary.MergedDictionaries.Add(Application.LoadComponent(new Uri(string.Format("/{0};component/{1}.xaml", assemblyName, resourceDictionary), UriKind.Relative)) as ResourceDictionary);
            }
            InitializeComponent();
            iUpdateOnExit = false;
            iHelper       = new HelperKinsky(Environment.GetCommandLineArgs(), new Invoker(this.Dispatcher));
            ICrashLogDumper d = new CrashLogDumperForm(this,
                                                       iHelper.Title,
                                                       iHelper.Product,
                                                       iHelper.Version);

            iHelper.AddCrashLogDumper(d);
            System.Windows.Forms.Application.SetUnhandledExceptionMode(System.Windows.Forms.UnhandledExceptionMode.ThrowException);
            iUIOptions = new UiOptions(iHelper);
            InitialiseStack();
            WindowChrome.SetIsMiniModeActive(mainWindowChrome, iUIOptions.MiniMode);
            SetWindowDimensions();
            iProcessedOptions  = true;
            AllowsTransparency = iTransparentOption.Native;
            this.Loaded       += new RoutedEventHandler(KinskyDesktop_Loaded);
        }
Example #4
0
        public KinskyDesktop()
        {
            iInstance = this;
            HttpWebRequest.DefaultWebProxy             = WebRequest.GetSystemWebProxy();
            HttpWebRequest.DefaultWebProxy.Credentials = CredentialCache.DefaultCredentials;
            iWindowLoaded = new AutoResetEvent(false);
            iImageCache   = new WpfImageCache(kCacheSize, kDownscaleImageSize, kThreadCount);
            iIconResolver = new IconResolver();
            ResourceDictionary dictionary   = App.Current.Resources;
            string             assemblyName = System.Reflection.Assembly.GetExecutingAssembly().FullName;

            string[] resourceDictionaries =
            {
                "Shared",
                "ControlStyles",
                "ScrollBar",
                "ComboBox",
                "ListBox",
                "TileViewStyle",
                "WindowChromeStyle",
                "MenuItem",
                "Slider"
            };

            foreach (string resourceDictionary in resourceDictionaries)
            {
                dictionary.MergedDictionaries.Add(Application.LoadComponent(new Uri(string.Format("/{0};component/Resources/{1}.xaml", assemblyName, resourceDictionary), UriKind.Relative)) as ResourceDictionary);
            }
            InitializeComponent();
            iUpdateOnExit = false;
            var invoker = new Invoker(this.Dispatcher);

            iHelper = new HelperKinsky(Environment.GetCommandLineArgs(), invoker);
#if DEBUG
            Xamarin.Insights.Initialize(kApiKeyDummyProject, iHelper.Version, iHelper.Product);
#else
            Xamarin.Insights.Initialize(kApiKey, iHelper.Version, iHelper.Product);
#endif

            ICrashLogDumper d = new CrashLogDumperForm(this,
                                                       iHelper.Title,
                                                       iHelper.Product,
                                                       iHelper.Version);
            iHelper.AddCrashLogDumper(d);
            System.Windows.Forms.Application.SetUnhandledExceptionMode(System.Windows.Forms.UnhandledExceptionMode.ThrowException);
            iUIOptions = new UiOptions(iHelper);
            InitialiseStack();
            Xamarin.Insights.Identify(iHelper.OptionInstallId.Value, null);
            WindowChrome.SetIsMiniModeActive(mainWindowChrome, iUIOptions.MiniMode);
            SetWindowDimensions();
            iProcessedOptions            = true;
            AllowsTransparency           = iTransparentOption.Native;
            this.Loaded                 += new RoutedEventHandler(KinskyDesktop_Loaded);
            iNotificationController      = new NotificationController(invoker, iHelper, new NotificationServerHttp(NotificationServerHttp.DefaultUri(iHelper.Product)), this, NotificationController.DefaultTimespan);
            viewKinsky.ShowOptionsDialog = () =>
            {
                ShowOptionsDialog(false);
            };
            Uri iconUri = new Uri("pack://application:,,,/icon.ico", UriKind.RelativeOrAbsolute); //make sure your path is correct, and the icon set as Resource
            this.Icon = BitmapFrame.Create(iconUri, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.OnLoad);
        }
Example #5
0
        private void InitialiseStack()
        {
            iEventCreated.WaitOne();
            iEventLock       = new object();
            iUserLogListener = new AndroidUserLogListener();
            UserLog.AddListener(iUserLogListener);
            iTraceListener = new AndroidTraceListener();
            Trace.AddListener(iTraceListener);
            iInvoker         = new Invoker(this.ApplicationContext);
            iResourceManager = new AndroidResourceManager(this.Resources);
            iIconResolver    = new IconResolver(iResourceManager);
            iLayoutInflater  = (LayoutInflater)GetSystemService(Context.LayoutInflaterService);

            iHelperKinsky = new HelperKinsky(new string[2] {
                "-t", kTraceLevel
            }, Invoker);
            Android.Runtime.AndroidEnvironment.UnhandledExceptionRaiser += UnhandledExceptionRaiser;

            // name the crash dumper section general and add other UI options
            OptionPageCrashDumper generalOptions = new OptionPageCrashDumper("General");

            iOptionExtendedTrackInfo = new OptionBool("trackinfo", "Extended track info", "Show extended track information for the current track", true);
            generalOptions.Add(iOptionExtendedTrackInfo);
            iOptionEnableRocker = new OptionBool("rocker", "Button controls", "Enable button controls for controlling volume and seeking", false);
            generalOptions.Add(iOptionEnableRocker);
            iOptionGroupTracks = new OptionBool("groupplaylist", "Group playlist tracks", "Grouping tracks by album within the playlist window", true);
            generalOptions.Add(iOptionGroupTracks);

            iOptionAutoLock = new OptionEnum("autolock", "Prevent auto-lock", "When to prevent auto-lock");
            iOptionAutoLock.AddDefault(kAutoLockNever);
            iOptionAutoLock.Add(kAutoLockCharging);
            iOptionAutoLock.Add(kAutoLockAlways);
            generalOptions.Add(iOptionAutoLock);
            iOptionAutoLock.EventValueChanged += OptionAutoLock_EventValueChangedHandler;
            iHelperKinsky.AddOptionPage(generalOptions);

            iHelperKinsky.SetStackExtender(this);
            iCrashLogDumper = new CrashDumper(this.ApplicationContext, Resource.Drawable.Icon, iHelperKinsky, generalOptions);
            iHelperKinsky.AddCrashLogDumper(iCrashLogDumper);

            iOptionInsertMode = new OptionInsertMode();
            iHelperKinsky.AddOption(iOptionInsertMode);

            iViewMaster = new ViewMaster();
            iHttpServer = new HttpServer(HttpServer.kPortKinskyDroid);
            iHttpClient = new HttpClient();

            iLibrary         = new MediaProviderLibrary(iHelperKinsky);
            iSharedPlaylists = new SharedPlaylists(iHelperKinsky);
            iLocalPlaylists  = new LocalPlaylists(iHelperKinsky, false);

            PluginManager pluginManager = new PluginManager(iHelperKinsky, iHttpClient, new MediaProviderSupport(iHttpServer));

            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);
            iHelperKinsky.AddOptionPage(iLocator.OptionPage);

            iSaveSupport = new SaveSupport(iHelperKinsky, iSharedPlaylists, optionSharedPlaylists, iLocalPlaylists, optionLocalPlaylists);
            iPlaySupport = new PlaySupport();
            iHelperKinsky.ProcessOptionsFileAndCommandLine();

            Linn.Kinsky.Model model = new Linn.Kinsky.Model(iViewMaster, iPlaySupport);
            iMediator = new Mediator(iHelperKinsky, model);

            iAndroidViewMaster = new AndroidViewMaster(this,
                                                       iViewMaster,
                                                       iInvoker,
                                                       iResourceManager,
                                                       iSaveSupport,
                                                       iIconResolver,
                                                       iOptionGroupTracks,
                                                       iOptionExtendedTrackInfo,
                                                       IsTabletView ? kMaxImageCacheSizeTablet : kMaxImageCacheSizePhone);

            iStackWatchdog = new System.Threading.Timer(StackWatchdogExpired);
            iPowerListener = new PowerStateListener(this.ApplicationContext);
            iPowerListener.EventPowerStateChanged += EventPowerStateChangedHandler;

            iIsCharging  = PowerStateListener.IsConnected(this.ApplicationContext);
            iRescanTimer = new System.Threading.Timer((e) =>
            {
                Rescan();
            });
            iRescanTimer.Change(Timeout.Infinite, Timeout.Infinite);
            SetAutoLock();
            EventLowMemory += EventLowMemoryHandler;
            iInitialised    = true;
            StartStack();
        }