コード例 #1
0
    public MainView()
    {
        this.SuspendLayout();

        this.DoubleBuffered = true;

        this.Height = 600;
        this.Width  = 600;

        this.Text = "PartsDB";

        tabControl           = new TabControl();
        tabControl.Dock      = DockStyle.Fill;
        tabControl.Selected += new TabControlEventHandler(delegate(object sender, TabControlEventArgs e) {
            if (e.TabPage == rsvTab)
            {
                activeTab = Tabs.RawSql;
            }
            else if (e.TabPage == rsvTab)
            {
                activeTab = Tabs.Prefs;
            }
            else if (e.TabPage == rsvTab)
            {
                activeTab = Tabs.Parts;
            }
            else if (e.TabPage == rsvTab)
            {
                activeTab = Tabs.Edit;
            }
        });
        Controls.Add(tabControl);

        partsTab   = new TabPage("Parts");
        parts      = new PartsView();
        parts.Dock = DockStyle.Fill;
        partsTab.Controls.Add(parts);
        tabControl.TabPages.Add(partsTab);

        partEditTab   = new TabPage("Edit Part");
        partEdit      = new PartEditView();
        partEdit.Dock = DockStyle.Fill;
        partEditTab.Controls.Add(partEdit);
        tabControl.TabPages.Add(partEditTab);

        pvTab   = new TabPage("Preferences");
        pv      = new PreferencesView();
        pv.Dock = DockStyle.Fill;
        pvTab.Controls.Add(pv);
        tabControl.TabPages.Add(pvTab);

        rsvTab   = new TabPage("Raw SQL");
        rsv      = new RawSqlView();
        rsv.Dock = DockStyle.Fill;
        rsvTab.Controls.Add(rsv);
        tabControl.TabPages.Add(rsvTab);


        this.ResumeLayout();
    }
コード例 #2
0
        public void PreferencesGeoScaling_RunGraph_Manual_Mode()
        {
            //The GeometryScalingCodeBlock.dyn contains a CodeBlock with a large number that needs ScaleFactor > Medium
            Open(@"core\GeometryScalingCodeBlock.dyn");

            //Creates the Preferences dialog and the ScaleFactor = 2 ( Medium)
            var preferencesWindow = new PreferencesView(View);

            preferencesWindow.Show();
            DispatcherUtil.DoEvents();

            //Change the RadioButton checked so the ScaleFactor is updated to -2 (Small)
            preferencesWindow.RadioSmall.IsChecked = true;
            DispatcherUtil.DoEvents();

            //Close the Preferences Dialog and due that the ScaleFactor was updated the MarkNodesAsModifiedAndRequestRun() method will be called
            preferencesWindow.CloseButton.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
            DispatcherUtil.DoEvents();

            //This will get the Circle.ByCenterPointRadius node (connected to the CodeBlock)
            var nodeView = NodeViewWithGuid("bcf1c893-5311-4dff-9a04-203ffb9d426c");

            //When RunType = Manual and the MarkNodesAsModifiedAndRequestRun() method is called, the graph won't be executed and the node state will remain in Active
            Assert.AreEqual(nodeView.ViewModel.State, ElementState.Active);
        }
コード例 #3
0
ファイル: App.xaml.cs プロジェクト: zdrawku/carnac
        void TrayIconOnOpenPreferences()
        {
            var preferencesViewModel = new PreferencesViewModel(settingsProvider, new ScreenManager());
            var preferencesView      = new PreferencesView(preferencesViewModel);

            preferencesView.Show();
        }
コード例 #4
0
        public void PackageManagerCrashTestOnDownloadingInvalidPackage()
        {
            string packageDirectory = Path.Combine(GetTestDirectory(ExecutingDirectory), @"pkgs\Autodesk Steel Package");

            try
            {
                LoadPackage(packageDirectory);
            }
            catch (Exception e)
            {
                Console.WriteLine("Failed to load the package: " + e);
            }

            var loader       = GetPackageLoader();
            var packageFound = loader.LocalPackages.Any(x => x.Name == "Autodesk Steel Connections 2020");

            Assert.IsFalse(packageFound);

            var preferencesWindow = new PreferencesView(View)
            {
                WindowStartupLocation = WindowStartupLocation.CenterOwner
            };

            preferencesWindow.Show();

            AssertWindowOwnedByDynamoView <PreferencesView>();
        }
コード例 #5
0
        public void PreferencesGeoScaling_RunGraph_Automatic()
        {
            //The GeometryScalingCodeBlock.dyn contains a CodeBlock with a large number that needs ScaleFactor > Medium
            Open(@"core\GeometryScalingCodeBlock.dyn");

            //Change the RunType to Automatic, so when the MarkNodesAsModifiedAndRequestRun() is called a graph execution will be kicked off
            View.RunSettingsControl.RunTypesComboBox.SelectedItem = View.RunSettingsControl.RunTypesComboBox.Items[1];
            DispatcherUtil.DoEvents();

            //This will get the Circle.ByCenterPointRadius node (connected to the CodeBlock)
            var nodeView = NodeViewWithGuid("bcf1c893-5311-4dff-9a04-203ffb9d426c");

            //Checking that the node is not in a warning state before changing the scale factor
            Assert.AreEqual(nodeView.ViewModel.State, ElementState.Active);

            //Creates the Preferences dialog and the ScaleFactor = 2 ( Medium)
            var preferencesWindow = new PreferencesView(View);

            preferencesWindow.Show();
            DispatcherUtil.DoEvents();

            //Change the RadioButton checked so the ScaleFactor is updated to -2 (Small)
            preferencesWindow.RadioSmall.IsChecked = true;
            DispatcherUtil.DoEvents();

            //Close the Preferences Dialog and due that the ScaleFactor was updated the MarkNodesAsModifiedAndRequestRun() method will be called
            preferencesWindow.CloseButton.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
            DispatcherUtil.DoEvents();

            //When RunType = Automatic when the graph is executed the ByCenterPointRadius node change status to Warning due that ScaleFactor = Small
            Assert.AreEqual(nodeView.ViewModel.State, ElementState.Warning);
        }
コード例 #6
0
        public void CanOpenManagePackagesDialogAndWindowIsOwned()
        {
            var preferencesWindow = new PreferencesView(View)
            {
                WindowStartupLocation = WindowStartupLocation.CenterOwner
            };

            preferencesWindow.Show();

            AssertWindowOwnedByDynamoView <PreferencesView>();
        }
コード例 #7
0
        public void ManagePackagesDialogClosesWithDynamo()
        {
            var preferencesWindow = new PreferencesView(View)
            {
                WindowStartupLocation = WindowStartupLocation.CenterOwner
            };

            preferencesWindow.Show();

            AssertWindowOwnedByDynamoView <PreferencesView>();
            AssertWindowClosedWithDynamoView <PreferencesView>();
        }
コード例 #8
0
    public MainView()
    {
        this.SuspendLayout();

        this.DoubleBuffered = true;

        this.Height = 600;
        this.Width = 600;

        this.Text = "PartsDB";

        tabControl = new TabControl();
        tabControl.Dock = DockStyle.Fill;
        tabControl.Selected += new TabControlEventHandler(delegate (object sender, TabControlEventArgs e) {
            if (e.TabPage == rsvTab) {
                activeTab = Tabs.RawSql;
            } else if (e.TabPage == rsvTab) {
                activeTab = Tabs.Prefs;
            } else if (e.TabPage == rsvTab) {
                activeTab = Tabs.Parts;
            } else if (e.TabPage == rsvTab) {
                activeTab = Tabs.Edit;
            }
        });
        Controls.Add(tabControl);

        partsTab = new TabPage("Parts");
        parts = new PartsView();
        parts.Dock = DockStyle.Fill;
        partsTab.Controls.Add(parts);
        tabControl.TabPages.Add(partsTab);

        partEditTab = new TabPage("Edit Part");
        partEdit = new PartEditView();
        partEdit.Dock = DockStyle.Fill;
        partEditTab.Controls.Add(partEdit);
        tabControl.TabPages.Add(partEditTab);

        pvTab = new TabPage("Preferences");
        pv = new PreferencesView();
        pv.Dock = DockStyle.Fill;
        pvTab.Controls.Add(pv);
        tabControl.TabPages.Add(pvTab);

        rsvTab = new TabPage("Raw SQL");
        rsv = new RawSqlView();
        rsv.Dock = DockStyle.Fill;
        rsvTab.Controls.Add(rsv);
        tabControl.TabPages.Add(rsvTab);

        this.ResumeLayout();
    }
コード例 #9
0
        public void PathsAddedToCustomPacakgePathPreferences_SurvivePreferenceDialogOpenClose()
        {
            //add a new path to the package paths
            Model.PreferenceSettings.CustomPackageFolders.Add(@"C:\doesNotExist");
            Model.PreferenceSettings.CustomPackageFolders.Add(@"C:\doesNotExist\dde.dll");

            //assert preference settings is correct after prefs window open and close.
            var preferencesWindow = new PreferencesView(View);

            //we use show because showDialog will block the test.
            preferencesWindow.Show();
            DispatcherUtil.DoEvents();
            preferencesWindow.CloseButton.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
            DispatcherUtil.DoEvents();

            //assert preference settings is correct.
            Assert.Contains(@"C:\doesNotExist", Model.PreferenceSettings.CustomPackageFolders);
            Assert.Contains(@"C:\doesNotExist\dde.dll", Model.PreferenceSettings.CustomPackageFolders);
        }
コード例 #10
0
        public MainForm()
        {
            welcomeView     = new WelcomeView(this);
            preferencesView = new PreferencesView(this);
            galleryView     = new GalleryView(this);

            Title      = "badabing";
            ClientSize = new Size(720, 480);
            Content    = new StackLayout
            {
                Orientation = Orientation.Vertical,
                HorizontalContentAlignment = HorizontalAlignment.Center,
                Spacing = 5,
                Padding = new Padding(10),
                Items   = { welcomeView, preferencesView, galleryView }
            };

            preferencesView.Visible = false;
            galleryView.Visible     = false;
        }
コード例 #11
0
        public ActionResult MatchRoom([FromBody] PreferencesView e)
        {
            using (var context = new MyDbContext())
            {
                var user    = HttpContext.User.Identity.Name;
                var userELO = context.Users.Where(u => user == u.UserName).Select(u => u.ELO).FirstOrDefault();

                var chatrooms = context.Chatrooms.Where(c => c.EventID == e.EventID && c.PeopleCount < 10).ToList();

                if (!e.AllowsMixedRooms)
                {
                    chatrooms = chatrooms.Where(c => c.HomeTeamRoom == e.SupportsHomeTeam).ToList();
                }

                int closestELO = chatrooms.Select(c => c.AverageELO).Aggregate((x, y) => Math.Abs(x - userELO) < Math.Abs(y - userELO) ? x : y);

                var roomID = context.Chatrooms.Where(c => c.AverageELO == closestELO).FirstOrDefault().ChatID;

                return(Json(roomID, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #12
0
 public OpenPreferencesCommand(PreferencesView view)
 {
     this.view = view;
 }