/NerdSharp.Net_Studio/NerdSharp_UberNet/Science/Comp_Sci/StudioComponents/SideComponents/Desktop.xaml.cs
C# | 108 lines | 88 code | 11 blank | 9 comment | 3 complexity | 8cf5263b23e8326baca2bcb26110c5e4 MD5 | raw file
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Navigation;
- using System.Windows.Shapes;
- using O = System.Windows.Forms.OpenFileDialog;
- using Stm = System.IO.Stream;
- using System.IO;
- using NerdSharp.Net_Studio.NerdSharp_UberNet.Science.Math.TypeLibrary.Graphs_ChartsWidgets;
-
- namespace NerdSharp.Net_Studio.NerdSharp_UberNet.Science.Comp_Sci.StudioComponents.SideComponents
- {
- /// <summary>
- /// Interaction logic for Desktop.xaml
- /// </summary>
- public partial class Desktop : UserControl
- {
- public Desktop()
- {
- InitializeComponent();
- }
-
- private void changeImageMenuItemLable_MouseDown(object sender, MouseButtonEventArgs e)
- {
- O openImgFile = new O();
- if (openImgFile.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
- try
- {
- bgImg.Source = new BitmapImage(new Uri(@openImgFile.FileName));
- }
- catch (IOException ex)
- {
- MessageBox.Show("Unable to obtain picture.");
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.ToString());
- }
- }
- }
-
- private void floorPolygon_Loaded(object sender, RoutedEventArgs e)
- {
-
- RenderRoom();
- }
-
- private void AddPoints()
- {
- floorPolygon.Points.Clear();
- for (int i = 0; i < 4; i++)
- {
- floorPolygon.Points.Add(new Point(0, 0));
- leftWallPolyGon.Points.Add(new Point(0, 0));
- }
- }
-
- private void RenderRoom()
- {
- AddPoints();
- //lower left corner
- floorPolygon.Points[0] = new Point(0, this.ActualHeight);
- //upper lett corner
- floorPolygon.Points[1] = new Point(this.ActualWidth / 3.5, this.ActualHeight / 3.5);
- //upper right corner
- floorPolygon.Points[2] = new Point(this.ActualWidth / 1.5, this.ActualHeight / 3.5);
- //lower right corner
- floorPolygon.Points[3] = new Point(this.ActualWidth, this.ActualHeight);
- //TwoDGraph graphTest = new TwoDGraph();
- leftWallPolyGon.Points[1] = new Point(this.ActualWidth / 3.5, this.ActualHeight / 5);
- leftWallPolyGon.Points[2] = floorPolygon.Points[2];
- leftWallPolyGon.Points[3] = floorPolygon.Points[3];
- leftWallPolyGon.Stroke = floorPolygon.Stroke;
- leftWallPolyGon.StrokeThickness = floorPolygon.StrokeThickness;
- //desktopGrid.Children.Add(graphTest);
- }
-
- private void desktopGrid_SizeChanged(object sender, SizeChangedEventArgs e)
- {
- RenderRoom();
-
- }
-
- private void browser_Click(object sender, RoutedEventArgs e)
- {
- desktopGrid.Children.Add(new VirtualWindow());
- }
-
- private void tilePictureCmBxItem_Selected(object sender, RoutedEventArgs e)
- {
- floorBgVisBrush.TileMode = TileMode.Tile;
- }
-
- private void tileTextBlock_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
- {
- floorBgVisBrush.TileMode = TileMode.Tile;
- }
- }
- }