コード例 #1
0
        private void topPanel_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            DateTime clickTime = DateTime.Now;

            if (clickTime.CompareTo(iLastTopPanelMouseDown.AddMilliseconds(iMouseDoubleClickTime)) < 0)
            {
                WindowChrome mainWindowChrome = this.FindVisualAncestor <WindowChrome>();
                if (!mainWindowChrome.IsAnimating)
                {
                    WindowChrome.SetIsMiniModeActive(mainWindowChrome, !WindowChrome.GetIsMiniModeActive(mainWindowChrome));
                }
                clickTime = DateTime.MinValue;
            }
            else
            {
                iLastTopPanelMouseDown = clickTime;
            }
        }
コード例 #2
0
ファイル: KinskyDesktop.xaml.cs プロジェクト: daviddw/Kinsky
        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);
        }