Exemple #1
0
        public AutoOptionsConfigWindow(AutoOptionsSettings aOSettingsParam, ExternalCommandData cDParam) : this()
        {
            aOSettings  = aOSettingsParam;
            DataContext = aOSettings;

            ////todo: this data binding doesn't work, perhaps because of reference value levels
            //System.Windows.Data.Binding warningBinding = new System.Windows.Data.Binding();
            //warningBinding.Mode = BindingMode.OneWay;
            //warningBinding.Source = selWarnOpts;
            //WarningOptionsPanel.DataContext = warningBinding;

            //System.Windows.Data.Binding errorBinding = new System.Windows.Data.Binding();
            //errorBinding.Mode = BindingMode.OneWay;
            //errorBinding.Source = selErrorOpts;
            //ErrorOptionsPanel.DataContext = errorBinding;

            //Set DataContext to null or it will be inherited from parent (set to aOSettings) till something is selected
            WarningOptionsPanel.DataContext = null;
            ErrorOptionsPanel.DataContext   = null;

            //Center the window on the main Revit window
            Autodesk.Revit.UI.Rectangle revitWindow = cDParam.Application.MainWindowExtents;
            Double centerWindowX = (revitWindow.Left + revitWindow.Right) / 2;
            Double centerWindowY = (revitWindow.Top + revitWindow.Bottom) / 2;

            Left = centerWindowX - Width / 2;
            Top  = centerWindowY - Height / 2;

            GenerateWarningsTree();
            GenerateErrorTree();
        }
Exemple #2
0
        private void UpdateWindowsPositionAndSize(Autodesk.Revit.UI.Rectangle viewRect)
        {
            var newLocation = new Point(viewRect.Left, viewRect.Top);

            this.Location = newLocation;
            this.Width    = viewRect.Right - viewRect.Left;
            this.Height   = viewRect.Bottom - viewRect.Top;
        }
Exemple #3
0
 //获取revit窗口
 public static void GetRevitWndRectangle(UIView view, ref int left, ref int top, ref int right, ref int bottom)
 {
     Autodesk.Revit.UI.Rectangle windowRectangle = view.GetWindowRectangle();
     left   = windowRectangle.Left;
     top    = windowRectangle.Top;
     right  = windowRectangle.Right;
     bottom = windowRectangle.Bottom;
 }
        public FailureCatcherWindow(AutoOptionsSettings aOSettings, AutoFailureHandlingOptions caughtFailOpts, UIApplication uiApp = null) : this()
        {
            DataContext = aOSettings;
            CaughtFailurePanel.DataContext = caughtFailOpts;

            //Center the window on the main Revit window. uiApp is not guaranteed to be set
            if (uiApp != null)
            {
                Autodesk.Revit.UI.Rectangle revitWindow = uiApp.MainWindowExtents;
                Double centerWindowX = (revitWindow.Left + revitWindow.Right) / 2;
                Double centerWindowY = (revitWindow.Top + revitWindow.Bottom) / 2;
                Left = centerWindowX - Width / 2;
                Top  = centerWindowY - Height / 2;
            }
        }