private void create_dire(object sender, RoutedEventArgs e)
        {
            Window3 w3 = new Window3();

            w3.creattitle += new Window3.myevent(createnewtitle);
            w3.Show();
        }
        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 #3
0
 private void button2_Click(object sender, RoutedEventArgs e)
 {
     if(passwordBox2.Password==str.passcheck)
     {
         Window3 Window3=new Window3();
         this.Close();
         Window3.Show();
     }
 }
        private void DodajZdjecie(object sender, RoutedEventArgs e)
        {
            Window3 dodajZdjecie = new Window3();

            dodajZdjecie.Show();
        }
Exemple #5
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            labelTimer.Content = "300";
            myTimer            = new System.Timers.Timer();
            myTimer.Interval   = 1000;
            myTimer.Elapsed   += new System.Timers.ElapsedEventHandler(TimerC);
            myTimer.Start();

            string file = "C:\\Users\\David\\Documents\\systemcreds.xml";

            //put an if statement here to prevent this when flag is not null
            if (String.IsNullOrEmpty(flag))
            {
                if (Registry.CurrentUser.OpenSubKey("PassProt\\", true).GetValue("Delay") == null)
                {
                    Registry.CurrentUser.OpenSubKey("PassProt\\", true).SetValue("Delay", "0", RegistryValueKind.String);
                }
                #region Initial Master Password
                if ((string)Registry.CurrentUser.OpenSubKey("PassProt\\", true).GetValue("Delay") == "0")
                {
                    this.Visibility = Visibility.Hidden;
                    string keyName   = @"HKEY_CURRENT_USER\PassProt";
                    string valueName = "mp";
                    if (Registry.GetValue(keyName, valueName, null) == null)
                    {
                        string       message = "You do not have a master password. Do you want to create one now?";
                        string       caption = "Master Password is Missing";
                        DialogResult result  = System.Windows.Forms.MessageBox.Show(message, caption, MessageBoxButtons.YesNo);
                        if (result == System.Windows.Forms.DialogResult.Yes)
                        {
                            Window2 createmasterpasswordform = new Window2();
                            this.Close();
                            createmasterpasswordform.Show();
                        }
                    }
                    else
                    {
                        Window3 entermasterpasswordform = new Window3();
                        this.Visibility = Visibility.Hidden;
                        entermasterpasswordform.Show();
                    }
                    if (FileOrDirectoryExists(file))
                    {
                        XmlDocument xDoc = new XmlDocument();
                        xDoc.Load(file);
                        XmlNodeList systems = xDoc.GetElementsByTagName("Name");
                        foreach (XmlNode node in systems)
                        {
                            comboBox.Items.Add(node.InnerText);
                        }
                    }
                }
                #endregion
                #region Set Delay to 15 minutes
                else if ((string)Registry.CurrentUser.OpenSubKey("PassProt\\", true).GetValue("Delay") == "1")
                {
                    if (DateTime.Now > (Convert.ToDateTime((string)Registry.CurrentUser.OpenSubKey("PassProt\\", true).GetValue("Time"))).AddMinutes(15))
                    {
                        Window3 entermasterpasswordform = new Window3();
                        this.Visibility = Visibility.Hidden;
                        entermasterpasswordform.Show();
                        Registry.CurrentUser.OpenSubKey("PassProt\\", true).SetValue("Delay", "0", RegistryValueKind.String);
                    }
                    else
                    {
                        XmlDocument xDoc = new XmlDocument();
                        xDoc.Load(file);
                        XmlNodeList systems = xDoc.GetElementsByTagName("Name");
                        foreach (XmlNode node in systems)
                        {
                            comboBox.Items.Add(node.InnerText);
                        }
                    }
                }
                #endregion
                #region Set Delay to 30 minutes
                else if ((string)Registry.CurrentUser.OpenSubKey("PassProt\\", true).GetValue("Delay") == "2")
                {
                    if (DateTime.Now > (Convert.ToDateTime(Registry.CurrentUser.OpenSubKey("PassProt\\", true).GetValue("Time"))).AddMinutes(30))
                    {
                        Window3 entermasterpasswordform = new Window3();
                        this.Visibility = Visibility.Hidden;
                        entermasterpasswordform.Show();
                        Registry.CurrentUser.OpenSubKey("PassProt\\", true).SetValue("Delay", "0", RegistryValueKind.String);
                    }
                    else
                    {
                        XmlDocument xDoc = new XmlDocument();
                        xDoc.Load(file);
                        XmlNodeList systems = xDoc.GetElementsByTagName("Name");
                        foreach (XmlNode node in systems)
                        {
                            comboBox.Items.Add(node.InnerText);
                        }
                    }
                }
                #endregion
                #region Set Delay to 1 hour
                else if ((string)Registry.CurrentUser.OpenSubKey("PassProt\\", true).GetValue("Delay") == "3")
                {
                    if (DateTime.Now > (Convert.ToDateTime(Registry.CurrentUser.OpenSubKey("PassProt\\", true).GetValue("Time"))).AddHours(1))
                    {
                        Window3 entermasterpasswordform = new Window3();
                        this.Visibility = Visibility.Hidden;
                        entermasterpasswordform.Show();
                        Registry.CurrentUser.OpenSubKey("PassProt\\", true).SetValue("Delay", "0", RegistryValueKind.String);
                    }
                    else
                    {
                        XmlDocument xDoc = new XmlDocument();
                        xDoc.Load(file);
                        XmlNodeList systems = xDoc.GetElementsByTagName("Name");
                        foreach (XmlNode node in systems)
                        {
                            comboBox.Items.Add(node.InnerText);
                        }
                    }
                }
                #endregion
            }
            else
            {
                XmlDocument xDoc = new XmlDocument();
                xDoc.Load(file);
                XmlNodeList systems = xDoc.GetElementsByTagName("Name");
                foreach (XmlNode node in systems)
                {
                    comboBox.Items.Add(node.InnerText);
                }
            }
        }
Exemple #6
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            Window3 wincalc = new Window3();

            wincalc.Show();       //income and costs
        }
        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);
            }
        }