コード例 #1
0
ファイル: MainWindow.xaml.cs プロジェクト: thijse/Colora
        public MainWindow()
        {
#if PORTABLE
            manager = new MiniAppManager(this, true);
#else
            manager = new MiniAppManager(this, false);
#endif
            manager.AddManagedProperty(nameof(IsMinimal));
            if (!(bool)manager.Settings["Updated"])
            {
                Properties.Settings.Default.Upgrade();
            }
            manager.Initialize();
            InitializeComponent();
            CurrentColor     = new NotifyColor(Color.FromRgb(255, 255, 255));
            this.DataContext = CurrentColor;
            msc              = new MouseScreenCapture();
            msc.CaptureTick += new EventHandler(capture_Tick);
            lastColors       = new FixedColorCollection();
            ((INotifyCollectionChanged)lstboxLast.Items).CollectionChanged += LastColors_CollectionChanged;
            if (Properties.Settings.Default.LatestColors != null)
            {
                lastColors = Properties.Settings.Default.LatestColors;
            }
            lstboxLast.ItemsSource = lastColors;
        }
コード例 #2
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     // Check for updates
     updateChecker.CheckForUpdates(UpdateNotifyMode.Auto);
     // Load color history
     if (Settings.Default.LatestColors != null)
     {
         colorHistory           = Settings.Default.LatestColors;
         colorHistory.MaxLength = Settings.Default.ColorHistoryLength;
     }
     else
     {
         colorHistory = new FixedColorCollection(Settings.Default.ColorHistoryLength);
     }
     lstHistory.ItemsSource = colorHistory;
     // Set current color
     CurrentColor = new NotifyColor(Settings.Default.CurrentColor);
     // Init screen picker
     ScreenPicker = new ScreenPicker(CurrentColor, imgScreen);
     ScreenPicker.PositionSelected += ScreenPicker_PositionSelected;
     // Set data context
     this.DataContext = this;
 }