Exemple #1
0
 public NotificationView(HelperKinsky aHelper)
 {
     iNotificationController = new NotificationController(aHelper.Invoker, aHelper, new NotificationServerHttp(NotificationServerHttp.DefaultUri(aHelper.Product)), this, NotificationController.DefaultTimespan);
 }
Exemple #2
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);
        }
Exemple #3
0
 public NotificationView(INotificationPersistence aPersistence, string aProduct, IInvoker aInvoker, UIViewController aParent)
 {
     iParent = aParent;
     iNotificationController   = new NotificationController(aInvoker, aPersistence, new NotificationServerHttp(NotificationServerHttp.DefaultUri(aProduct)), this, NotificationController.DefaultTimespan);
     NotificationView.Instance = this;
 }
Exemple #4
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);
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            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);
            iOptionTabletLayout = new OptionBool("tabletlayout", "Use tablet layout", "Use tablet layout", IsTabletView);
            iOptionTabletLayout.EventValueChanged += iOptionTabletLayout_EventValueChanged;
            if (iAllowTabletView)
            {
                generalOptions.Add(iOptionTabletLayout);
            }

            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();
            iNotificationController = new NotificationController(iInvoker, iHelperKinsky, new NotificationServerHttp(NotificationServerHttp.DefaultUri(iHelperKinsky.Product)), iNotificationView, NotificationController.DefaultTimespan);

            Xamarin.Insights.Identify(iHelperKinsky.OptionInstallId.Value, null);

            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();
        }