Example #1
0
        private void AutorunChB_Click(object sender, RoutedEventArgs e)
        {
            autorunChB.IsEnabled = false;
            UpdateLayout();

            Action             AutorunChAction;
            MyProjectInstaller myProjectInstaller;


            if (autorunChB.IsChecked.Value)
            {
                AutorunChAction = () => {
                    myProjectInstaller = new MyProjectInstaller(ExpectedState.Install, data.configFolder);
                };
            }
            else
            {
                AutorunChAction = () => {
                    myProjectInstaller = new MyProjectInstaller(ExpectedState.Uninstall, data.configFolder);
                };
            }

            Task AutorunChTask = new Task(AutorunChAction);

            AutorunChTask.Start();

            Task UITask = AutorunChTask.ContinueWith(a =>
            {
                autorunChB.IsEnabled = true;
            }, TaskScheduler.FromCurrentSynchronizationContext());
        }
Example #2
0
        public MainWindow()
        {
            data = new WyprostujSieBackground.Data(true, true);
            using (MyProjectInstaller mpi = new MyProjectInstaller(ExpectedState.Stop, data.configFolder))

                kinect = new WyprostujSieBackground.Kinect(true);
            kalmanFilters = new WyprostujSieBackground.KalmanFilter[3];
            notifications = new Notifications();

            InitializeComponent();
            this.autorunChB.IsChecked = MyProjectInstaller.Installed();
            this.autorunChB.IsEnabled = IsAdmin;
            if (!IsAdmin)
            {
                notifications.AddNotif(Properties.Resources.adminNotif.ToString(), Brushes.Yellow, "admin");
            }

            SetValuaes();

            if (!Files.CopyFiles(data.configFolder))
            {
                this.notifications.AddNotif(Properties.Resources.errorFilesCopy, Brushes.Yellow, "files");
            }

            dispatcherTimer          = new DispatcherTimer();
            dispatcherTimer.Interval = TimeSpan.FromSeconds(5);
            dispatcherTimer.Tick    += SetStatus;
            dispatcherTimer.Start();
        }
Example #3
0
    // </Snippet1>

    // <Snippet2>
    public static int Main()
    {
        // Creates a new installer.
        MyProjectInstaller myNewProjectInstaller = new MyProjectInstaller();

        // Gets the attributes for the collection.
        AttributeCollection attributes = TypeDescriptor.GetAttributes(myNewProjectInstaller);

        /* Prints whether to run the installer by retrieving the
        * RunInstallerAttribute from the AttributeCollection. */
        RunInstallerAttribute myAttribute =
            (RunInstallerAttribute)attributes[typeof(RunInstallerAttribute)];

        Console.WriteLine("Run the installer? " + myAttribute.RunInstaller.ToString());

        return(0);
    }
Example #4
0
 private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     kinect.newData -= UpdateScreen;
     kinect          = null;
     using (MyProjectInstaller mpi = new MyProjectInstaller(ExpectedState.Start, data.configFolder)) { };
 }