Ejemplo n.º 1
0
 //check it later
 private void ComponentSelector_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     VisualGrid.ChangeState(typeof(ComponentState));
     if (VisualGrid.currentState.GetType() == typeof(ComponentState))
     {
         ComponentState cs = (ComponentState)VisualGrid.currentState;
         cs.ComponentType = (Type)ComponentSelector.SelectedItem;
         cs.CreateTemporaryComp_Visual();
     }
 }
        public void RefreshData()
        {
            UsersService service = new UsersService();

            users = new ObservableCollection <UserEntity>(service.GetAllUser());
            this.lvUsers.ItemsSource = users;

            if (GlobalInfo.IsUserAdmin && !this.UserGrid.Columns.Contains(VisualGrid.TryFindResource("PasswordColumn") as GridViewColumn))
            {
                this.UserGrid.Columns.Add(VisualGrid.TryFindResource("PasswordColumn") as GridViewColumn);
                this.UserGrid.Columns.Move(2, 1);
                this.UpdateLayout();
            }
        }
Ejemplo n.º 3
0
        //happens when mouse wheel is turned on canvas
        private void Canvas_MouseWheel(object sender, MouseWheelEventArgs e)
        {
            //control if pressed it zooms in or out.
            if (Keyboard.IsKeyDown(Key.LeftCtrl))
            {
                VisualGrid.ZoomInOut(e.Delta);
            }

            //pan while holding alter
            else
            {
                VisualGrid.Pan(e.Delta, Keyboard.IsKeyDown(Key.LeftAlt));
            }
        }
Ejemplo n.º 4
0
        public MainWindow()
        {
            //splash screen
            //StartUpSplash splash = new StartUpSplash();
            //splash.Show();

            //main code
            InitializeComponent();

            this.WindowState = WindowState.Maximized;
            this.Title       = "Node";
            ComponentSymbols.LoadSymbols();
            Log = SystemGrid.Informer;

            ConsoleManager.Show();
            try
            {
                canvas = VisualGrid.GenerateGrid();
                VisualGrid.SetStatusIndicator(this.Status);
                ParentCanvas.Children.Add(canvas);
            }
            catch (InvalidCanvasSizeExeption e)
            {
                Console.WriteLine(e.Message);
                MessageBox.Show(e.Message);
            }

            ComponentManager.schematicsCanvas = canvas;
            //databinding
            this.ComponentSelector.ItemsSource = ComponentManager.GetSymbolList();
            this.Output.ItemsSource            = Log.GetInfo();


            //adding functions
            VisualGrid.SelectedObjectChanged        += PropertyGridSelectionChange;
            this.ComponentSelector.SelectionChanged += ComponentSelector_SelectionChanged;
            this.canvas.MouseWheel          += Canvas_MouseWheel;
            this.canvas.MouseMove           += Canvas_MouseMove;
            this.canvas.MouseLeftButtonDown += Canvas_MouseLeftButtonDown;
            this.ParentCanvas.MouseWheel    += ParentCanvas_MouseWheel;
            this.KeyDown += KeyBoarInputPreview;
            //test
            this.Button_Simulate.Click += Test_Click;

            //end splash
            //Thread.Sleep(2000);
            //splash.Close();
        }