示例#1
0
        /// <summary>
        /// Constructor of the SampleViewModel class. This will initialize all of the necessary properties and displays
        /// the sample view in the Revit UI.
        /// </summary>
        /// <param name="doc">The Revit document in wich this command is being executed on</param>
        public SampleViewModel(Document doc)
        {
            window = new SampleView();

            ViewsByViewTypesDict =
                new FilteredElementCollector(doc)
                .OfCategory(BuiltInCategory.OST_Views)
                .WhereElementIsNotElementType()
                .Cast <View>()
                .Where(v => !v.IsTemplate)
                .GroupBy(v => v.ViewType)
                .ToDictionary(view => view.Key.ToString(),
                              view => view
                              .Select(v => v.Name)
                              .ToList());

            ViewTypes = new ObservableCollection <string>(ViewsByViewTypesDict.Keys.ToList());
            SViewType = ViewTypes.FirstOrDefault();

            NumSelectedViews = "0";

            ObjectsToView.ListChanged += OnListChanged;

            OKCommand     = new ActionRelayCommand(Execute, canExecute);
            CancelCommand = new ActionRelayCommand(Cancel);

            window.DataContext = this;
            window.ShowDialog();
        }
示例#2
0
        public TextBoxFile() : base()
        {
            //Loaded += TextBoxFile_Loaded;
            CmdOpenFile = new ActionRelayCommand(new Action(onOpenFile));

            //TextChanged += (object sender, TextChangedEventArgs e) => {
            //	if (e.OriginalSource != this) {
            //		e.Handled = true;
            //	}
            //};
            TextChanged += (object sender, TextChangedEventArgs e) => {
                updateShowText();
            };
        }
示例#3
0
 public TextBoxCheckbox() : base()
 {
     //Loaded +=TextBoxCheckbox_Loaded;
     CmdChecked   = new ActionRelayCommand(new Action(onChecked));
     CmdUnchecked = new ActionRelayCommand(new Action(onUnchecked));
 }