Inheritance: Window
        public MainWindow()
        {
            InitializeComponent();

            if ( Settings.Default[ "exit" ].ToString() == "1" )
            {
                w3 = new Window3();
                w3.Show();
                this.Close();
            }

            else
            {
                var path = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Run";
                RegistryKey key = Registry.CurrentUser.OpenSubKey( path , true );
                key.SetValue( "ADsyncAPP" , System.IO.Path.GetDirectoryName( System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName )+"\\ADsyncApp.exe" );

                lbl.Visibility = Visibility.Hidden;
                username1 = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
                lbl.Content = username1;
                lbl.Visibility = Visibility.Visible;
                string pat = GetTempPath();
                BusyBar.IsBusy = false;
                System.IO.File.WriteAllText( pat + "\\My Log File.txt" , string.Empty );

                MessageBox.Show( Settings.Default[ "exit" ].ToString() );
            }
        }
Exemple #2
0
 private void button2_Click(object sender, RoutedEventArgs e)
 {
     if(passwordBox2.Password==str.passcheck)
     {
         Window3 Window3=new Window3();
         this.Close();
         Window3.Show();
     }
 }
		/**
		 * Connect to the clientUI.colorChange event
		 *
		 * Update the colors in the side state list
		 **/
		private void listBox_setup(uint val, System.Drawing.Color[] colors) {
			// Convert colors to integer values
			int[] cvals = new int[colors.Length];
			for (int i = 0; i < colors.Length; i++) {
				cvals[i] = colors[i].R << 16;
				cvals[i] |= colors[i].G << 8;
				cvals[i] |= colors[i].B;
			}

			// On the dispatcher thread, clear old entries, create a new entry
			// for each state. Set its color to the color for the state
			listBox1.Dispatcher.BeginInvoke(new Action(() => {
				listBox1.Items.Clear();
				int i = 0;
				foreach (int v in cvals) {
					var sp = new StackPanel();
					sp.Orientation = Orientation.Horizontal;
					var img = new Image();
					img.Height = 10;
					img.Width = 10;
					var bmap = new WriteableBitmap(1, 1, 96, 96, PixelFormats.Bgr32, null);
					img.Source = bmap;
					bmap.Lock();
					unsafe {
						int* buffer = (int*)bmap.BackBuffer;
						*buffer = v;
					}

					bmap.AddDirtyRect(new Int32Rect(0, 0, 1, 1));
					bmap.Unlock();

					sp.Children.Add(img);
					var label = new Label();
					label.Content = "State " + i;
					sp.Children.Add(label);
					int num = i;
					// Add an event to bring up a color chooser and change a state's color
					img.MouseUp += (o, e) => {
						var cp = new Window3();
						cp.setColor(cvals[num]);
						if (cp.ShowDialog() == true) {
							clientui.setColor((uint) num, cp.Color);
						}
					};
					listBox1.Items.Add(sp);
					i++;
				}
			}));
		}
        private void Button_Click( object sender , RoutedEventArgs e )
        {
            try
            {
                    ad = new Thread( connectad );

                    ad.Start();
                    BusyBar.IsBusy = true;

                    if ( er == 0 )
                    {
                        string connectedmsg = System.String.Format( "{0:G}: {1}." , System.DateTime.Now , "Connected" );
                        LogM(connectedmsg);
                        w3 = new Window3();
                        w3.Show();
                        this.Close();
                    }

            }

            catch ( Exception ex )
            {
                MessageBox.Show("Exception just occurred: " + ex, "Exception Sample", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }