Esempio n. 1
0
        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;
        }
        public MainWindow()
        {
            // Create a new instance of MiniAppManager for WPF.
            // The second parameter specifies if the manager should be run in portable mode.
            man = new MiniAppManager(this, false);

            // (Optional) Fill some data used in the 'About' box.
            var          baseUri = BaseUriHelper.GetBaseUri(this);
            BitmapSource img     = new BitmapImage(new Uri(baseUri, @"/bluelogo.png"));

            man.ProductColor   = Color.FromRgb(51, 85, 119);
            man.ProductImage   = img;
            man.ProductWebsite = new Link("http://example.org", "Example.org");
            man.ProductLicense = new Link("https://opensource.org/licenses/BSD-3-Clause", "BSD-3-Clause License");

            // (Optional) If set to true (false by default), the manager checks for '/portable' or
            // '--portable' options given at startup. If it finds one of these it runs in portable mode.
            man.PortableModeArgEnabled = true;
            man.MakePortable(Properties.Settings.Default);

            // Add any public property of your window with this method to let its state
            // be saved when the application is closed and loaded when it starts.
            man.AddManagedProperty(nameof(this.OpenCount));

            // (Optional) Specifiy a list of cultures your application supports to fill a combo box
            // that allows switching between these. If this property is not specified,
            // the combo box won't be visible on the 'About' box.
            man.SupportedCultures = new CultureInfo[] { new CultureInfo("en"), new CultureInfo("de") };

            // Initialize the manager. Please make sure this method is called BEFORE you initialize your window.
            man.Initialize();

            // (Optional) Tells the manager to check for updates at the given URL. An XML file
            // containing a serialized AppUpdate object is expected at that location.
            // This method should also be called before the initialization of the window.
            man.CheckForUpdates("http://example.org/updates/TestWpfApp.xml");

            // (Together with update checking) Set this property to true to show an update notification every time
            // the application is started. On default, a notification is shown only every time a newer version is detected.
            man.UpdateNotifyEveryStartup = true;

            //Initialize the window.
            InitializeComponent();

            // The saved settings of the manager can be accessed.
            this.DataContext = man.Settings;
        }
Esempio n. 3
0
 public RulerForm()
 {
     Settings = new Settings();
     manager  = new MiniAppManager(this, true)
     {
         AlwaysTrackResize = true
     };
     // Name all the properties we want to have persisted
     manager.AddManagedProperty(nameof(Settings));
     manager.AddManagedProperty(nameof(CustomLines), SettingsSerializeAs.Binary);
     manager.AddManagedProperties(nameof(Opacity), nameof(TopMost));
     manager.Initialize();
     InitializeComponent();
     this.SetStyle(ControlStyles.ResizeRedraw, true);
     this.DoubleBuffered = true;
     this.TopMost        = true;
     CustomLines         = new LinkedList <int>();
     this.MouseWheel    += RulerForm_MouseWheel;
 }