/** * Pop up the dialog to create a CASettings directly. * Save the values then attempt to load the CA to the clientUI. * We save the state to make it easier to fix errors if they occur. **/ private void CA_Create(object sender, RoutedEventArgs e) { var w1 = new Window1(); w1.CAName = state.Name; w1.NumStates = state.NumStates; w1.Neighborhood = state.Neighborhood; w1.Delta = state.Delta; if (w1.ShowDialog() == true) { state.Name = w1.CAName; state.NumStates = w1.NumStates; state.Neighborhood = w1.Neighborhood.Substring(1,w1.Neighborhood.Length-2); state.Delta = w1.Delta.Substring(1, w1.Delta.Length - 2); clientui.loadCA(w1.CAName, w1.NumStates, 0, w1.Neighborhood, w1.Delta); } }
public MainWindow() { InitializeComponent(); Window1 load = new Window1(); SplashScreen splash = new SplashScreen("dv.jpg"); if (load.ShowDialog() == true) { path = load.path; if (!File.Exists(path)) { var result = MessageBox.Show("No File"); Application.Current.Shutdown(); } splash.Show(false); } else { Application.Current.Shutdown(); } plotter1.Background = Brushes.Transparent; plotter1.BorderBrush = Brushes.Transparent; plotter1.AxisGrid.Visibility = Visibility.Hidden; ArrayList vol = new ArrayList(); // traded lot volume ArrayList a = getData(ref vol); /* --- Setting charts --- */ var rt = new EnumerableDataSource <Point>((IEnumerable <Point>)a.ToArray(typeof(Point))); rt.SetXMapping(x => x.X); rt.SetYMapping(y => y.Y); chart = plotter.AddLineGraph(rt, curColour, new PenDescription("Data")); rt = new EnumerableDataSource <Point>((IEnumerable <Point>)vol.ToArray(typeof(Point))); rt.SetXMapping(x => x.X); rt.SetYMapping(y => y.Y + ticmin - ticmin / 1000); barchart = new LineGraph(rt); barchart = plotter1.AddLineGraph(rt, newColour, new PenDescription("Bar")); /* ------------------------- */ /* --- Setting Rect --- */ var axis = (DateTimeAxis)plotter.HorizontalAxis; double xMin = axis.ConvertToDouble(dtmin); double xMax = axis.ConvertToDouble(dtmax); Rect visibleRect = new Rect(xMin, ticmin - ticmin / 1000 /* this is yMin */, xMax / 2 - xMin / 2 /* this is width */, ticmax - ticmin + ticmin / 800 /* this is YMax - YMin = height */); if (path == "Ticks.csv") { visibleRect = new Rect(xMin, ticmin + ticmin / 1000 /* this is yMin */, (xMax - xMin) / 3 /* this is width */, ticmax - ticmin * 1.2 /* this is YMax - YMin = height */); } plotter.Viewport.Visible = visibleRect; plotter1.Viewport.Visible = visibleRect; plotter.Viewport.SetBinding(Viewport2D.VisibleProperty, new Binding("Visible") { Source = plotter1.Viewport, Mode = BindingMode.TwoWay }); /* --------------------- */ splash.Close(new TimeSpan(0, 0, 3)); }
private void button3_Click(object sender, RoutedEventArgs e) { var s = new Window1(mainWindow); s.ShowDialog(); }
private void MenuItem_Click_0(object sender, RoutedEventArgs e) { Window1 f2 = new Window1(); f2.ShowDialog(); }
private void CommandBinding_Executed_1(object sender, ExecutedRoutedEventArgs e) { var s = new Window1(this); s.ShowDialog(); }
private void videoget() { string link; IEnumerable <VideoInfo> videoInfos; try { link = youtlink.Text; videoInfos = DownloadUrlResolver.GetDownloadUrls(link); } catch { Error1 e1 = new Error1(); e1.ShowDialog(); return; } quality q1 = new quality(); id_prog.Visibility = System.Windows.Visibility.Visible; q1.ShowDialog(); qual = q1.quali; VideoInfo video;// = videoInfos.First(info => info.VideoType == VideoType.Mp4 && info.Resolution == 360); try { video = videoInfos.First(info => info.VideoType == VideoType.Mp4 && info.Resolution == qual); } catch { tb3.Text = "Unavailable"; video = videoInfos.First(info => info.VideoType == VideoType.Mp4 && info.Resolution == 360); } id_prog.Visibility = System.Windows.Visibility.Hidden; tb3.Text = video.Resolution.ToString(); fileName = Locat.Text + video.Title + ".mp4"; //System.IO.Path.GetFileName(url1.LocalPath); _source = video.DownloadUrl; _destination = fileName; percl = GetContentLength(); if (!File.Exists(_destination)) { Start(); } else { Window1 Win = new Window1(); Win.ShowDialog(); if (Win.check == 1) { abc.Text = "File to be overwritten"; File.Delete(_destination); Start(); abc.Text = "Done "; } else { abc.Text = "Operation Aborted"; } } }
/// <summary> /// The default constructor that calls the registration window /// </summary> public MainWindow() { InitializeComponent(); try { StreamReader sr = new StreamReader("setting_server.txt"); ip_adres_serser = sr.ReadLine().Remove(0, 11); Window1 w1 = new Window1(); w1.ShowDialog(); LogPass lp = new LogPass(); lp.ShowDialog(); if (close == false) { this.Close(); } else { lable1.Content = name_user + " " + surname_user; MessageBox.Show(string.Format("Добро пожаловать {0} {1} ", name_user, surname_user)); ShowMessage(); TabController.SelectedIndex = 0; TabController.SelectedItem = Message; this.MyId.Content = "Мой Id: " + MainWindow.id_user; } } catch (FileNotFoundException) { FileStream fs = new FileStream("seting_server.txt", FileMode.OpenOrCreate); byte[] buf_seting_file = new byte[4096]; buf_seting_file = Encoding.Unicode.GetBytes("ip server: 192.168.2.103"); fs.Write(buf_seting_file, 0, buf_seting_file.Length); ip_adres_serser = "192.168.2.103"; Window1 w1 = new Window1(); w1.ShowDialog(); LogPass lp = new LogPass(); lp.ShowDialog(); if (close == false) { this.Close(); } else { lable1.Content = name_user + " " + surname_user; MessageBox.Show(string.Format("Добро пожаловать {0} {1} ", name_user, surname_user)); ShowMessage(); TabController.SelectedIndex = 0; TabController.SelectedItem = Message; this.MyId.Content = "Мой Id: " + MainWindow.id_user; } } catch (DirectoryNotFoundException) { FileStream fs = new FileStream("seting_server.txt", FileMode.OpenOrCreate); byte[] buf_seting_file = new byte[4096]; buf_seting_file = Encoding.Unicode.GetBytes("ip server: 192.168.2.103"); fs.Write(buf_seting_file, 0, buf_seting_file.Length); ip_adres_serser = "192.168.2.103"; Window1 w1 = new Window1(); w1.ShowDialog(); LogPass lp = new LogPass(); lp.ShowDialog(); if (close == false) { this.Close(); } else { lable1.Content = name_user + " " + surname_user; MessageBox.Show(string.Format("Добро пожаловать {0} {1} ", name_user, surname_user)); ShowMessage(); TabController.SelectedIndex = 0; TabController.SelectedItem = Message; this.MyId.Content = "Мой Id: " + MainWindow.id_user; } } catch (Exception ex) { MessageBox.Show(ex.Message); this.Close(); } }