本文整理汇总了C#中Infrastructure.Common.RelayCommand类的典型用法代码示例。如果您正苦于以下问题:C# RelayCommand类的具体用法?C# RelayCommand怎么用?C# RelayCommand使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RelayCommand类属于Infrastructure.Common命名空间,在下文中一共展示了RelayCommand类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ZoneDevicesViewModel
public ZoneDevicesViewModel()
{
AddCommand = new RelayCommand<object>(OnAdd, CanAdd);
RemoveCommand = new RelayCommand<object>(OnRemove, CanRemove);
Devices = new ObservableCollection<ZoneDeviceViewModel>();
AvailableDevices = new ObservableCollection<ZoneDeviceViewModel>();
}
示例2: PlanDesignerView
public PlanDesignerView()
{
InitializeComponent();
_scrollViewer.PreviewMouseDown += OnMouseMiddleDown;
_scrollViewer.PreviewMouseUp += OnMouseMiddleUp;
_scrollViewer.PreviewMouseMove += OnMiddleMouseMove;
_scrollViewer.MouseLeave += OnMiddleMouseLeave;
_scrollViewer.PreviewMouseWheel += OnPreviewMouseWheel;
_scrollViewer.ScrollChanged += OnScrollViewerScrollChanged;
slider.ValueChanged += OnSliderValueChanged;
deviceSlider.ValueChanged += new RoutedPropertyChangedEventHandler<double>(deviceSlider_ValueChanged);
Loaded += new RoutedEventHandler(OnLoaded);
_scrollViewer.SizeChanged += new SizeChangedEventHandler(OnSizeChanged);
_scrollViewer.LayoutUpdated += new EventHandler(OnLayoutUpdated);
_timer = new DispatcherTimer()
{
Interval = TimeSpan.FromMilliseconds(100),
IsEnabled = false,
};
_timer.Tick += (s, e) => _locked = false;
_requreRefresh = true;
_locked = true;
Dispatcher.ShutdownStarted += (s, e) => RegistrySettingsHelper.SetDouble(DeviceZoomSetting, deviceSlider.Value);
ZoomInCommand = new RelayCommand(OnZoomIn, CanZoomIn);
ZoomOutCommand = new RelayCommand(OnZoomOut, CanZoomOut);
DeviceZoomInCommand = new RelayCommand(OnDeviceZoomIn, CanDeviceZoomIn);
DeviceZoomOutCommand = new RelayCommand(OnDeviceZoomOut, CanDeviceZoomOut);
}
示例3: UsersViewModel
public UsersViewModel()
{
Menu = new UsersMenuViewModel(this);
DeleteCommand = new RelayCommand(OnDelete, CanDelete);
EditCommand = new RelayCommand(OnEdit, CanEdit);
AddCommand = new RelayCommand(OnAdd);
}
示例4: DescriptorViewModel
public DescriptorViewModel(BaseDescriptor descriptor)
{
GKBaseDescriptor = descriptor;
GKDescriptorNo = descriptor.GKBase.GKDescriptorNo;
KauDescriptorNo = descriptor.GKBase.KAUDescriptorNo;
SetAutomaticRegimeCommand = new RelayCommand(OnSetAutomaticRegime);
SetManualRegimeCommand = new RelayCommand(OnSetManualRegime);
SetIgnoreRegimeCommand = new RelayCommand(OnSetIgnoreRegime);
ShowParametersCommand = new RelayCommand(OnShowParameters);
ShowMeasureCommand = new RelayCommand(OnShowMeasure);
ShowCardReaderCommand = new RelayCommand(OnShowCardReader);
InitializeTest();
InitializeDustiness();
InitializeController();
InitializeTypeNo();
InitializeFire();
InitializeTurning();
InitializeLogic();
InitializeDelays();
InitializeAll();
AdditionalShortParameters = new List<ushort>();
for (int i = 0; i < 10; i++)
{
AdditionalShortParameters.Add(0);
}
}
示例5: CameraDetailsViewModel
public CameraDetailsViewModel(Camera camera)
{
ShowCommand = new RelayCommand(OnShow);
SetPtzPresetCommand = new RelayCommand(OnSetPtzPreset, CanSetPtzPreset);
AlarmSetChannelCommand = new RelayCommand(OnAlarmSetChannel, CanAlarmSetChannel);
AlarmDisableChannelCommand = new RelayCommand(OnAlarmDisableChannel, CanAlarmDisableChannel);
Camera = camera;
Title = Camera.PresentationName;
Camera.StatusChanged += OnCameraStatusChanged;
Presets = new ObservableCollection<int>();
for (int i = 0; i < camera.CountPresets; i++)
{
Presets.Add(i + 1);
}
SelectedPreset = Presets.FirstOrDefault();
if (Camera != null)
{
Width = Camera.ShowDetailsWidth;
Height = Camera.ShowDetailsHeight;
MarginLeft = Camera.ShowDetailsMarginLeft;
MarginTop = Camera.ShowDetailsMarginTop;
IsRecordOnline = Camera.IsRecordOnline;
IsOnGuard = Camera.IsOnGuard;
Status = Camera.Status;
PlanLinks = new PlanLinksViewModel(Camera);
}
}
示例6: DoorViewModel
public DoorViewModel(GKDoor door)
{
Door = door;
DoorDetailsViewModel = new DoorDetailsViewModel(door);
State.StateChanged -= OnStateChanged;
State.StateChanged += OnStateChanged;
OnStateChanged();
EnterDevice = GKManager.Devices.FirstOrDefault(x => x.UID == Door.EnterDeviceUID);
ExitDevice = GKManager.Devices.FirstOrDefault(x => x.UID == Door.ExitDeviceUID);
EnterButton = GKManager.Devices.FirstOrDefault(x => x.UID == Door.EnterButtonUID);
ExitButton = GKManager.Devices.FirstOrDefault(x => x.UID == Door.ExitButtonUID);
LockDevice = GKManager.Devices.FirstOrDefault(x => x.UID == Door.LockDeviceUID);
LockDeviceExit = GKManager.Devices.FirstOrDefault(x => x.UID == Door.LockDeviceExitUID);
LockControlDevice = GKManager.Devices.FirstOrDefault(x => x.UID == Door.LockControlDeviceUID);
LockControlDeviceExit = GKManager.Devices.FirstOrDefault(x => x.UID == Door.LockControlDeviceExitUID);
EnterZone = GKManager.SKDZones.FirstOrDefault(x => x.UID == Door.EnterZoneUID);
ExitZone = GKManager.SKDZones.FirstOrDefault(x => x.UID == Door.ExitZoneUID);
ShowOnPlanCommand = new RelayCommand(OnShowOnPlan, CanShowOnPlan);
ShowJournalCommand = new RelayCommand(OnShowJournal);
ShowPropertiesCommand = new RelayCommand(OnShowProperties);
ShowOnPlanOrPropertiesCommand = new RelayCommand(OnShowOnPlanOrProperties);
ShowDeviceCommand = new RelayCommand<GKDevice>(OnShowDevice);
ShowZoneCommand = new RelayCommand<GKSKDZone>(OnShowZone);
}
示例7: DeviceDetailsViewModel
public DeviceDetailsViewModel(Device device)
{
ExecuteCommand = new RelayCommand(OnExecute);
DeviceCommands = new List<DeviceCommandViewModel>();
Device = device;
DeviceState = Device.DeviceState;
DeviceState.StateChanged += new Action(OnStateChanged);
DeviceState.ParametersChanged += new Action(OnParametersChanged);
OnStateChanged();
Title = Device.DottedPresentationAddressAndName;
TopMost = true;
var tableNo = MetadataHelper.GetDeviceTableNo(device);
var metadataDeviceCommands = MetadataHelper.Metadata.devicePropInfos.Where(x => x.tableType == tableNo);
foreach (var metadataDeviceCommand in metadataDeviceCommands)
{
var deviceCommandViewModel = new DeviceCommandViewModel()
{
Name = metadataDeviceCommand.name,
Caption = metadataDeviceCommand.caption,
};
DeviceCommands.Add(deviceCommandViewModel);
}
SelectedDeviceCommand = DeviceCommands.FirstOrDefault();
}
示例8: TariffDetailsViewModel
public TariffDetailsViewModel(Tariff tariff = null)
{
EditDevicesCommand = new RelayCommand(OnEditDevicesCommand);
TariffTypes = new ObservableCollection<TariffType>(Enum.GetValues(typeof(TariffType)).Cast<TariffType>());
TariffParts = new ObservableCollection<TariffPartViewModel>();
if (tariff == null)
{
IsNew = true;
Tariff = new Tariff
{
Description = "",
Devices = new List<Device>(),
Name = "Новый тариф",
TariffParts = new List<TariffPart>(),
};
Title = "Создание нового тарифа";
SelectedTariffPartsNumber = 1;
}
else
{
IsNew = false;
Tariff = tariff;
Title = "Редактирование тарифа: " + tariff.TariffType.ToDescription();
SelectedTariffPartsNumber = tariff.TariffParts.Count;
SelectedTariffType = tariff.TariffType;
}
GetMaxTariffParts();
}
示例9: LayoutPartDescriptionViewModel
public LayoutPartDescriptionViewModel(ILayoutPartDescription layoutPartDescription)
{
LayoutPartDescription = layoutPartDescription;
VisualizationState = VisualizationState.Prohibit;
AddCommand = new RelayCommand(OnAddCommand, CanAddCommand);
DragCommand = new RelayCommand(OnDragCommand, CanAddCommand);
}
示例10: MainViewModel
public MainViewModel()
{
Current = this;
Title = "Сервер ОПС FS2";
ExitCommand = new RelayCommand(OnExit);
ShowLogCommand = new RelayCommand(OnShowLog);
}
示例11: MPTDeviceViewModel
public MPTDeviceViewModel(GKMPTDevice mptDevice)
{
MPTDevice = mptDevice;
Device = mptDevice.Device;
MPTDevicePropertiesViewModel = new MPTDevicePropertiesViewModel(Device, false);
ShowPropertiesCommand = new RelayCommand(OnShowProperties, CanShowProperties);
}
示例12: DesignerItemBase
public DesignerItemBase(ElementBase element)
: base(element)
{
_contextMenu = null;
ShowPropertiesCommand = new RelayCommand(OnShowProperties);
DeleteCommand = new RelayCommand(OnDelete);
}
示例13: MainViewModel
public MainViewModel()
{
Current = this;
ShowImitatorCommand = new RelayCommand(OnShowImitator);
Clients = new ObservableCollection<ClientViewModel>();
Title = "Сервер ОПС FireSec-2";
}
示例14: CameraDetailsViewModel
public CameraDetailsViewModel(Camera camera = null)
{
ShowZonesCommand = new RelayCommand(OnShowZones);
TestCommand = new RelayCommand(OnTest);
StateClasses = new List<XStateClass>();
StateClasses.Add(XStateClass.Fire1);
StateClasses.Add(XStateClass.Fire2);
StateClasses.Add(XStateClass.Attention);
StateClasses.Add(XStateClass.Ignore);
if (camera != null)
{
Title = "Редактировать камеру";
Camera = camera;
}
else
{
Title = "Создать камеру";
Camera = new Camera()
{
Name = "Новая камера",
Address = "192.168.0.1"
};
}
CopyProperties();
}
示例15: ValidationErrorsViewModel
public ValidationErrorsViewModel()
{
ClickCommand = new RelayCommand(OnClick);
EditValidationCommand = new RelayCommand(OnEditValidation);
CloseValidationCommand = new RelayCommand(OnCloseValidation);
Validate();
}