Exemplo n.º 1
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);
        }
Exemplo n.º 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);
        }