private void MainWindow_Load(object sender, EventArgs e) { SubWindow.Top = this.Top; SubWindow.Left = this.Right; SubWindow.Show(); LoadSettings(); }
public string OpenWindow(string pageKey, Point position, object parameter = null) { Type page; lock (_pages) { if (!_pages.TryGetValue(pageKey, out page)) { throw new ArgumentException( string.Format("Page not found: {0}. Did you forget to call SubWindowsService.Configure?", pageKey), nameof(pageKey)); } } var subWindow = new SubWindow { X = position.X, Y = position.Y }; _subWindowsPanel.Children.Add(subWindow); subWindow.Show(); subWindow.Loaded += (sender, e) => { subWindow.Navigate(page, parameter); }; subWindow.Closed += SubWindow_Closed; _subWindows.Add(subWindow.Id, subWindow); return(subWindow.Id); }
/// <summary> /// 초기값 설정 /// </summary> private void InitMainWindow() { _rHwnd = IntPtr.Zero; this.WindowStartupLocation = WindowStartupLocation.CenterOwner; //MainWindow View Model Data Context _mainWindowVM = new MainWindowVM(this, _rHwnd); this.DataContext = _mainWindowVM; //SubWindow도 MainWindow View Model을 DataContext 설정 _subWindow = new SubWindow(_mainWindowVM); _subWindow.DataContext = _mainWindowVM; this.WindowStartupLocation = WindowStartupLocation.CenterOwner; _subWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner; _subWindow.Show(); }
private void BtnClose_Click(object sender, RoutedEventArgs e) { Formdata f = new Formdata(); using (FileStream fs = new FileStream(System.Reflection.Assembly.GetEntryAssembly().Location.Replace(@"\FesToolPCForm.exe", "") + "/Files/Metadata/Formdata.frd", FileMode.Open, FileAccess.Read)) { using (StreamReader sr = new StreamReader(fs)) { f = JsonConvert.DeserializeObject <Formdata>((string)new Encryption().DecryptFile(sr.ReadToEnd(), Properties.Resources.Key)); } } f.FirstBoot = false; using (FileStream fs = new FileStream(System.Reflection.Assembly.GetEntryAssembly().Location.Replace(@"\FesToolPCForm.exe", "") + "/Files/Metadata/Formdata.frd", FileMode.Open, FileAccess.Write)) { using (StreamWriter sw = new StreamWriter(fs)) { sw.Write((string)new Encryption().EncryptFile(JsonConvert.SerializeObject(f), Properties.Resources.Key)); } } if (mnw == null) { try { MainWindow main = new MainWindow(); main.m = m; main.Show(); this.Close(); } catch { SubWindow sub = new SubWindow(); sub.m = m; sub.Show(); this.Close(); } } else { this.Close(); } }
private void button1_Click(object sender, RoutedEventArgs e) { SubWindow subWindow = new SubWindow(); subWindow.Show(); string to = ; string from = "*****@*****.**"; MailMessage message = new MailMessage(from, to); message.Subject = "Using the new SMTP client."; message.Body = @"Using this new feature, you can send an e-mail message from an application very easily."; SmtpClient client = new SmtpClient(server); client.UseDefaultCredentials = true; try { client.Send(message); } catch (Exception ex) { Console.WriteLine("Exception caught in CreateTestMessage2(): {0}", ex.ToString()); } }
private void OpenSubWindow() { SubWindow subWindow = new SubWindow(); subWindow.Show(); }
private async void Boot() { lblTask.Content = "Creating directories"; CreateDirectories(); lblTask.Content = "Connecting to the internet"; //var ping = new System.Net.NetworkInformation.Ping(); //var result = ping.Send("www.google.com"); if (!File.Exists(System.Reflection.Assembly.GetEntryAssembly().Location.Replace(@"\FesToolPCForm.exe", "") + "/Files/Metadata/Formdata.frd")) { using (FileStream fs = new FileStream(System.Reflection.Assembly.GetEntryAssembly().Location.Replace(@"\FesToolPCForm.exe", "") + "/Files/Metadata/Formdata.frd", FileMode.Create, FileAccess.Write)) { using (StreamWriter sw = new StreamWriter(fs)) { f.FirstBoot = true; sw.Write((string)new Encryption().EncryptFile(JsonConvert.SerializeObject(f), Properties.Resources.Key)); } } } else { using (FileStream fs = new FileStream(System.Reflection.Assembly.GetEntryAssembly().Location.Replace(@"\FesToolPCForm.exe", "") + "/Files/Metadata/Formdata.frd", FileMode.Open, FileAccess.Read)) { using (StreamReader sr = new StreamReader(fs)) { f = JsonConvert.DeserializeObject <Formdata>((string)new Encryption().DecryptFile(sr.ReadToEnd(), Properties.Resources.Key)); } } } //if (result.Status == System.Net.NetworkInformation.IPStatus.Success) //{ lblTask.Content = "Downloading metadata"; try { await GetFile(System.Reflection.Assembly.GetEntryAssembly().Location.Replace(@"\FesToolPCForm.exe", "") + "/Files/Metadata/Metadata.mtd", "/Splatfest/Metadata/Metadata.mtd"); using (FileStream fs = new FileStream(System.Reflection.Assembly.GetEntryAssembly().Location.Replace(@"\FesToolPCForm.exe", "") + "/Files/Metadata/Metadata.mtd", FileMode.Open, FileAccess.Read)) { using (StreamReader sr = new StreamReader(fs)) { m = JsonConvert.DeserializeObject <Metadata>((string)new Encryption().DecryptFile(sr.ReadToEnd(), Properties.Resources.Key)); if (m.Announce > DateTime.UtcNow || m.End < DateTime.UtcNow) { MessageBox.Show("There is currently no Splatfest going on. Injecting files will not be possible."); } if (m.HasCustomStage == true) { MessageBox.Show("Note: This Splatfest will have a custom stage! However, the files for this stage will not be distributed until the Splatfest starts! Please use this tool to safely install and deinstall these files!"); } lblTask.Content = "Downloading original files"; try { await DownloadFiles(); lblTask.Content = "Loading FesTool"; try { if (f.FirstBoot == false) { MainWindow a = new MainWindow(); a.m = m; if (f.Address != "" && f.Address != null) { a.SavedAddress = f.Address; } a.Show(); this.Close(); } else { Tutorial t = new Tutorial(); t.m = m; t.Show(); this.Close(); } } catch { if (f.FirstBoot == false) { SubWindow a = new SubWindow(); a.m = m; if (f.Address != "" && f.Address != null) { a.SavedAddress = f.Address; } a.Show(); this.Close(); } else { Tutorial t = new Tutorial(); t.m = m; t.Show(); this.Close(); } } } catch { MessageBox.Show("Could not retrieve original Splatfest files. Please try again later."); this.Close(); } } } } catch { MessageBox.Show("Could not get the metadata file. Please try again later."); this.Close(); } //} //else //{ // MessageBox.Show("Could not connect to the internet. Please make sure you have a working internet connection and try again."); // this.Close(); //} }
private void ButtonClicked(object sender, RoutedEventArgs e) { SubWindow subWindow = new SubWindow(); subWindow.Show(); }