public void OnButtClick(object sender, RoutedEventArgs e) { FileButton <Section> butt = sender as FileButton <Section>; Prof.ProfSection = butt.File; this.Close(); }
public void AddToList(Profile file) { FileButton <Profile> fileButton = new FileButton <Profile>(file) { Margin = new Thickness(10, 5, 5, 10), Height = 100, Width = 200, Content = file.Name }; fileButton.Click += OnProfileButtonClick; ProfilesStack.Children.Add(fileButton); ProfileCollection.Add(file); }
void ReleaseDesignerOutlets() { if (FileButton != null) { FileButton.Dispose(); FileButton = null; } if (FolderButton != null) { FolderButton.Dispose(); FolderButton = null; } }
protected override void OnApplyTemplate() { Button = GetTemplateChild(nameof(Button)) as FileButton; Progress = GetTemplateChild(nameof(Progress)) as ProgressVoice; Subtitle = GetTemplateChild(nameof(Subtitle)) as TextBlock; Button.Click += Button_Click; _templateApplied = true; if (_message != null) { UpdateMessage(_message); } }
protected override void OnApplyTemplate() { Texture = GetTemplateChild(nameof(Texture)) as Border; Button = GetTemplateChild(nameof(Button)) as FileButton; Title = GetTemplateChild(nameof(Title)) as TextBlock; Subtitle = GetTemplateChild(nameof(Subtitle)) as TextBlock; Button.Click += Button_Click; _templateApplied = true; if (_message != null) { UpdateMessage(_message); } }
private void AddButtons() { for (int i = 0; i < fileList.Count; i++) { DisplayFile file = fileList[i]; GameObject newButton = fileDirectory.Get_Object(); newButton.transform.SetParent(contentPanel); FileButton fileButton = newButton.GetComponent <FileButton>(); //if (fileButton.FileText == null){ // fileButton.FileText = fileButton.GetComponent<Text>(); // fileButton.FileImage = fileButton.GetComponent<Image>(); //} fileButton.Setup(file, this); } }
private void OnProfileButtonClick(object sender, RoutedEventArgs e) { FileButton <Profile> fileButton = sender as FileButton <Profile>; if (current == null) { current = fileButton; ChangeButtons(true); fileButton.Background = new System.Windows.Media.SolidColorBrush(Colors.DarkGray); } else { current = null; ChangeButtons(false); fileButton.Background = new System.Windows.Media.SolidColorBrush(Colors.LightGray); } }
protected override void OnApplyTemplate() { LayoutRoot = GetTemplateChild(nameof(LayoutRoot)) as AspectView; Texture = GetTemplateChild(nameof(Texture)) as Image; Button = GetTemplateChild(nameof(Button)) as FileButton; Player = GetTemplateChild(nameof(Player)) as AnimationView; Overlay = GetTemplateChild(nameof(Overlay)) as Border; Subtitle = GetTemplateChild(nameof(Subtitle)) as TextBlock; Button.Click += Button_Click; _templateApplied = true; if (_message != null) { UpdateMessage(_message); } }
private void OnMakeProfileButtonClick(object sender, RoutedEventArgs e) { Profile profile = new Profile(); profile.ProfKmlFile = ChosenFile; ChooseSectionWindow chooseSectionWindow = new ChooseSectionWindow(profile); foreach (Section i in SectionCollection) { FileButton <Section> button = new FileButton <Section>(i); button.Margin = new Thickness(10, 5, 5, 10); button.Content = i.Name; button.Click += chooseSectionWindow.OnButtClick; chooseSectionWindow.Stack.Children.Add(button); } chooseSectionWindow.ShowDialog(); StringPackage pac = new StringPackage(""); NewName newName = new NewName(pac); newName.ShowDialog(); profile.Name = pac.Content; AddToList(profile); }
public LoadBlockMeshDialog(Screen screen) : base(screen) { // 開く際に openAnimation で Width を設定するので 0 で初期化します。 Width = 0; ShadowOffset = new Vector2(4); Padding = new Thickness(16); var stackPanel = new StackPanel(screen) { Orientation = Orientation.Vertical, HorizontalAlignment = HorizontalAlignment.Stretch }; Content = stackPanel; var pageButtonPanel = new StackPanel(screen) { HorizontalAlignment = HorizontalAlignment.Right }; stackPanel.Children.Add(pageButtonPanel); var backPageButton = new Button(screen) { Focusable = false, Width = BlockViewerGame.SpriteSize, HorizontalAlignment = HorizontalAlignment.Left, Content = new Image(screen) { Texture = screen.Content.Load <Texture2D>("UI/ArrowLeft") } }; backPageButton.Click += (Control s, ref RoutedEventContext c) => { ViewModel.BackPage(); }; pageButtonPanel.Children.Add(backPageButton); pageTextBlock = new TextBlock(screen) { Width = BlockViewerGame.SpriteSize * 2, ForegroundColor = Color.White, BackgroundColor = Color.Black, ShadowOffset = new Vector2(2) }; pageButtonPanel.Children.Add(pageTextBlock); var forwardPageButton = new Button(screen) { Focusable = false, Width = BlockViewerGame.SpriteSize, HorizontalAlignment = HorizontalAlignment.Right, Content = new Image(screen) { Texture = screen.Content.Load <Texture2D>("UI/ArrowRight") } }; forwardPageButton.Click += (Control s, ref RoutedEventContext c) => { ViewModel.ForwardPage(); }; pageButtonPanel.Children.Add(forwardPageButton); var fileListPanel = new StackPanel(screen) { Orientation = Orientation.Vertical, HorizontalAlignment = HorizontalAlignment.Stretch }; stackPanel.Children.Add(fileListPanel); for (int i = 0; i < fileButtons.Length; i++) { fileButtons[i] = new FileButton(screen) { HorizontalAlignment = HorizontalAlignment.Stretch }; fileButtons[i].Click += OnFileButtonClick; fileButtons[i].KeyDown += OnFileNameButtonKeyDown; fileListPanel.Children.Add(fileButtons[i]); } var separator = ControlUtil.CreateDefaultSeparator(screen); stackPanel.Children.Add(separator); cancelButton = ControlUtil.CreateDefaultDialogButton(screen, Strings.CancelButton); cancelButton.Click += (Control s, ref RoutedEventContext c) => Close(); stackPanel.Children.Add(cancelButton); const float windowWidth = 480; openAnimation = new FloatLerpAnimation { Action = (current) => { Width = current; }, From = 0, To = windowWidth, Duration = TimeSpan.FromSeconds(0.1f) }; Animations.Add(openAnimation); // 閉じる場合には closeAnimation を実行し、その完了で完全に閉じます。 closeAnimation = new FloatLerpAnimation { Action = (current) => { Width = current; }, From = windowWidth, To = 0, Duration = TimeSpan.FromSeconds(0.1f) }; closeAnimation.Completed += (s, e) => base.Close(); Animations.Add(closeAnimation); }
public LoadBlockMeshDialog(Screen screen) : base(screen) { // 開く際に openAnimation で Width を設定するので 0 で初期化します。 Width = 0; ShadowOffset = new Vector2(4); Padding = new Thickness(16); var stackPanel = new StackPanel(screen) { Orientation = Orientation.Vertical, HorizontalAlignment = HorizontalAlignment.Stretch }; Content = stackPanel; var pageButtonPanel = new StackPanel(screen) { HorizontalAlignment = HorizontalAlignment.Right }; stackPanel.Children.Add(pageButtonPanel); var backPageButton = new Button(screen) { Focusable = false, Width = BlockViewerGame.SpriteSize, HorizontalAlignment = HorizontalAlignment.Left, Content = new Image(screen) { Texture = screen.Content.Load<Texture2D>("UI/ArrowLeft") } }; backPageButton.Click += (Control s, ref RoutedEventContext c) => { ViewModel.BackPage(); }; pageButtonPanel.Children.Add(backPageButton); pageTextBlock = new TextBlock(screen) { Width = BlockViewerGame.SpriteSize * 2, ForegroundColor = Color.White, BackgroundColor = Color.Black, ShadowOffset = new Vector2(2) }; pageButtonPanel.Children.Add(pageTextBlock); var forwardPageButton = new Button(screen) { Focusable = false, Width = BlockViewerGame.SpriteSize, HorizontalAlignment = HorizontalAlignment.Right, Content = new Image(screen) { Texture = screen.Content.Load<Texture2D>("UI/ArrowRight") } }; forwardPageButton.Click += (Control s, ref RoutedEventContext c) => { ViewModel.ForwardPage(); }; pageButtonPanel.Children.Add(forwardPageButton); var fileListPanel = new StackPanel(screen) { Orientation = Orientation.Vertical, HorizontalAlignment = HorizontalAlignment.Stretch }; stackPanel.Children.Add(fileListPanel); for (int i = 0; i < fileButtons.Length; i++) { fileButtons[i] = new FileButton(screen) { HorizontalAlignment = HorizontalAlignment.Stretch }; fileButtons[i].Click += OnFileButtonClick; fileButtons[i].KeyDown += OnFileNameButtonKeyDown; fileListPanel.Children.Add(fileButtons[i]); } var separator = ControlUtil.CreateDefaultSeparator(screen); stackPanel.Children.Add(separator); cancelButton = ControlUtil.CreateDefaultDialogButton(screen, Strings.CancelButton); cancelButton.Click += (Control s, ref RoutedEventContext c) => Close(); stackPanel.Children.Add(cancelButton); const float windowWidth = 480; openAnimation = new FloatLerpAnimation { Action = (current) => { Width = current; }, From = 0, To = windowWidth, Duration = TimeSpan.FromSeconds(0.1f) }; Animations.Add(openAnimation); // 閉じる場合には closeAnimation を実行し、その完了で完全に閉じます。 closeAnimation = new FloatLerpAnimation { Action = (current) => { Width = current; }, From = windowWidth, To = 0, Duration = TimeSpan.FromSeconds(0.1f) }; closeAnimation.Completed += (s, e) => base.Close(); Animations.Add(closeAnimation); }
private void DoAnalize(FileButton <Profile> butt) { SectionReadWindow sectionReadWindow = new SectionReadWindow(butt.File.ProfSection, false); sectionReadWindow.ShowDialog(); Kml file = (Kml)butt.File.ProfKmlFile.Root; List <Placemark> lineList = new List <Placemark>(); ExtractPlacemarks(file.Feature, lineList); LineString line = new LineString(); try { line = lineList.Single().Geometry as LineString; } catch { MessageBox.Show("Kml nie spełnia wymogów profilu. Należy wczytać plik zawierający jedną linię."); } List <Coord.Vector> points = new List <Coord.Vector>(); foreach (Coord.Vector j in line.Coordinates) { points.Add(j); } Coord.Vector startCoord = points[0]; Coord.Vector endCoord = points[points.Count - 1]; List <System.Windows.Point> secPoints = sectionReadWindow.Points; List <Coord.Vector> vectors = new List <Coord.Vector>(); int pointsAmount = sectionReadWindow.Points.Count; double profLength = CoordinatesCalculator.CalculateDistance(startCoord.Latitude, startCoord.Longitude, endCoord.Latitude, endCoord.Longitude); double sectionLength = sectionReadWindow.LastPoint.X - sectionReadWindow.ZeroPoint.X; double scale = profLength / sectionLength; double maxDepth = sectionReadWindow.LastPoint.Y - sectionReadWindow.ZeroPoint.Y; double azimuth = CoordinatesCalculator.CalculateBearing(startCoord, endCoord); var pp = from t in secPoints orderby t.X ascending select t; secPoints = pp.ToList <System.Windows.Point>(); List <byte> depths = new List <byte>(); byte depth = new byte(); for (int i = 0; i < pointsAmount; i++) { depth = (byte)(secPoints[i].Y / maxDepth * 255); double dist; if (i == 0) { dist = secPoints[i].X * scale; vectors.Add(startCoord); depths.Add((byte)(sectionReadWindow.ZeroPoint.Y / maxDepth * 255)); } else { dist = (secPoints[i].X - secPoints[i - 1].X) * scale; } Coord.Vector vector = CoordinatesCalculator.CalculatePoint(vectors[vectors.Count - 1], dist, azimuth); vectors.Add(vector); depths.Add(depth); } vectors.RemoveAt(vectors.Count - 1); depths.RemoveAt(depths.Count - 1); vectors.RemoveAt(vectors.Count - 1); depths.RemoveAt(depths.Count - 1); vectors.Add(endCoord); depths.Add(depths[depths.Count - 1]); Document document = new Document(); document.Name = butt.File.Name + ".kml"; for (int i = 1; i < vectors.Count; i++) { AddSingleLineToContainer(vectors[i - 1], vectors[i], (byte)((depths[i] + depths[i - 1]) / 2), document, i); } List <Coord.Vector> markers = new List <Coord.Vector>(); foreach (var point in sectionReadWindow.Markers) { double dist = point.X * scale; Coord.Vector vector = CoordinatesCalculator.CalculatePoint(startCoord, dist, azimuth); markers.Add(vector); } int n = 1; foreach (var coord in markers) { AddMarkerToContainer(coord, document, n); n++; } Kml kml = new Kml(); kml.Feature = document; KmlFile kmlFile = KmlFile.Create(kml, true); AddToList(kmlFile); SaveKmls(kmlFile); FileButton <KmlFile> button = new FileButton <KmlFile>(kmlFile) { Height = 40, Margin = new Thickness(10, 5, 5, 10), Content = document.Name }; button.Click += OnOutFileButtonClick; OutStack.Children.Add(button); }
public void UpdateWindows() { int docIndex = 0; int toolIndex = 0; List<Button> fileButtons = new List<Button>(); List<Button> toolButtons = new List<Button>(); foreach (IDockContent icontent in mMainWindow.DockContentHistory) { DockContent content = icontent as DockContent; if (content != null) { Button button = new FileButton(mButtonSettings); button.Tag = content; button.Text = content.TabText; button.TextAlign = ContentAlignment.MiddleLeft; button.FlatStyle = FlatStyle.Flat; button.AutoEllipsis = true; button.Margin = new Padding(1); button.Width = 160; button.Height -= 6; button.Enter += new EventHandler(FileButton_Enter); button.Leave += new EventHandler(FileButton_Leave); button.MouseClick += new MouseEventHandler(FileButton_MouseClick); if (content.DockState == DockState.Document) { button.TabIndex = docIndex++; fileButtons.Add(button); } else { button.TabIndex = toolIndex++; toolButtons.Add(button); } } } this.SuspendLayout(); panelActiveFiles.SuspendLayout(); panelActiveFiles.Controls.Clear(); panelActiveFiles.Controls.AddRange(fileButtons.ToArray()); panelActiveFiles.ResumeLayout(); panelActiveToolWindows.SuspendLayout(); panelActiveToolWindows.Controls.Clear(); panelActiveToolWindows.Controls.AddRange(toolButtons.ToArray()); panelActiveToolWindows.ResumeLayout(); this.ResumeLayout(); if (panelActiveFiles.Controls.Count > 1) panelActiveFiles.Controls[1].Select(); else if (panelActiveFiles.Controls.Count > 0) panelActiveFiles.Controls[0].Select(); }
public void UpdateWindows() { int docIndex = 0; int toolIndex = 0; List <Button> fileButtons = new List <Button>(); List <Button> toolButtons = new List <Button>(); foreach (IDockContent icontent in mMainWindow.DockContentHistory) { DockContent content = icontent as DockContent; if (content != null) { Button button = new FileButton(mButtonSettings); button.Tag = content; button.Text = content.TabText; button.TextAlign = ContentAlignment.MiddleLeft; button.FlatStyle = FlatStyle.Flat; button.AutoEllipsis = true; button.Margin = new Padding(1); button.Width = 160; button.Height -= 6; button.Enter += new EventHandler(FileButton_Enter); button.Leave += new EventHandler(FileButton_Leave); button.MouseClick += new MouseEventHandler(FileButton_MouseClick); if (content.DockState == DockState.Document) { button.TabIndex = docIndex++; fileButtons.Add(button); } else { button.TabIndex = toolIndex++; toolButtons.Add(button); } } } this.SuspendLayout(); panelActiveFiles.SuspendLayout(); panelActiveFiles.Controls.Clear(); panelActiveFiles.Controls.AddRange(fileButtons.ToArray()); panelActiveFiles.ResumeLayout(); panelActiveToolWindows.SuspendLayout(); panelActiveToolWindows.Controls.Clear(); panelActiveToolWindows.Controls.AddRange(toolButtons.ToArray()); panelActiveToolWindows.ResumeLayout(); this.ResumeLayout(); if (panelActiveFiles.Controls.Count > 1) { panelActiveFiles.Controls[1].Select(); } else if (panelActiveFiles.Controls.Count > 0) { panelActiveFiles.Controls[0].Select(); } }
private void startButton_Click(object sender, EventArgs e) { refresh = refreshBox.Checked; //checks that inputs are valid foreach (DataGridViewRow row in board.Rows) { foreach (DataGridViewCell cell in row.Cells) { int num = -1; if (cell.Value != null && cell.Value.ToString().Length > 1) { MessageBox.Show("Make sure only one number is written in a cell"); return; } else if (cell.Value != null && !int.TryParse(cell.Value.ToString(), out num)) { MessageBox.Show("Make sure only numbers are in written in a box. No extra charecters"); return; } } } //puts zero into blank cells foreach (DataGridViewRow row in board.Rows) { foreach (DataGridViewCell cell in row.Cells) { if (cell.Value == null) { cell.Value = 0; } } } startButton.Hide(); FileButton.Hide(); refreshBox.Hide(); //populate the tiles list foreach (DataGridViewRow row in board.Rows) { foreach (DataGridViewCell cell in row.Cells) { if (cell.Value.ToString() != "0") { tiles.Add(new int[] { cell.ColumnIndex, row.Index }); cell.Style.BackColor = Color.LightBlue; } } } board.Refresh(); bool worked = false; int x = 0; int y = 0; //TODO fix backtracking //iterate through y axis (rows) for (y = 0; y < 9; y++) { //iterate through x axis (cells) for (x = 0; x < 9; x++) { //reset bool worked = false; //check to see if cell can be changed if (protect(x, y)) { continue; } //check 1-9 for the cell for (int i = 1; i <= 9; i++) { //increment number and refresh board board.Rows[y].Cells[x].Value = i; if (refresh) { board.Refresh(); } //check to see if the change is viable in its row, column, and square if (checkRow(board.Rows[y].Cells[x]) && checkColumn(board.Rows[y].Cells[x]) && checkSquare(board.Rows[y].Cells[x])) { worked = true; break; } } //if the change is legal, move on to the next cell if (worked) { continue; } //if all 1-9 dont work, backtrack board.Rows[y].Cells[x].Value = 0; int[] coords = backtrack(x, y); x = coords[0]; y = coords[1]; } } }