Here are the examples of the csharp api System.Windows.Input.ICommand.Execute(object) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
833 Examples
19
Source : ARFlatGroupAdapter.cs
with Apache License 2.0
from AppRopio
with Apache License 2.0
from AppRopio
protected virtual void ExecuteCommandOnItem(ICommand command, object itemDataContext)
{
if (command?.CanExecute(itemDataContext) == true && itemDataContext != null)
{
command.Execute(itemDataContext);
}
}
19
Source : BindableSearchBar.cs
with Apache License 2.0
from AppRopio
with Apache License 2.0
from AppRopio
private void OnCancel(object sender, EventArgs e)
{
Text = null;
ResignFirstResponder();
if (CancelCommand != null)
CancelCommand.Execute(null);
}
19
Source : BindableWebVIew.cs
with Apache License 2.0
from AppRopio
with Apache License 2.0
from AppRopio
private void HandleLoadFinished(object sender, EventArgs ev)
{
var url = Url?.ToString();
var command = this.LoadFinishedCommand;
if (command != null && command.CanExecute(url))
command.Execute(url);
}
19
Source : BaseCollectionViewSource.cs
with Apache License 2.0
from AppRopio
with Apache License 2.0
from AppRopio
public override void WillDisplayCell(UICollectionView collectionView, UICollectionViewCell cell, NSIndexPath indexPath)
{
if ((indexPath.Row >= (ItemsSource.Count() - FromBottomCellStartLoadingIndex)) && MoreCommand != null && MoreCommand.CanExecute(null))
MoreCommand.Execute(null);
}
19
Source : BaseTableViewSource.cs
with Apache License 2.0
from AppRopio
with Apache License 2.0
from AppRopio
public override void WillDisplay(UITableView tableView, UITableViewCell cell, NSIndexPath indexPath)
{
if ((indexPath.Row >= (ItemsSource.Count() - FromBottomCellStartLoadingIndex)) &&
LoadMoreCommand != null && LoadMoreCommand.CanExecute(null))
{
LoadMoreCommand.Execute(null);
}
}
19
Source : ARLinearLayoutAdapter.cs
with Apache License 2.0
from AppRopio
with Apache License 2.0
from AppRopio
public void OnClick(View view)
{
if (view?.Tag is IMvxLisreplacedemView mvxLisreplacedemView && (ItemClick?.CanExecute(mvxLisreplacedemView.DataContext) ?? false))
{
ItemClick?.Execute(mvxLisreplacedemView.DataContext);
}
}
19
Source : BindableSearchController.cs
with Apache License 2.0
from AppRopio
with Apache License 2.0
from AppRopio
private void OnCancel(object sender, EventArgs e)
{
SearchBar.Text = null;
ResignFirstResponder();
if (CancelCommand != null)
CancelCommand.Execute(null);
}
19
Source : ARSimpleFragmentPagerAdapter.cs
with Apache License 2.0
from AppRopio
with Apache License 2.0
from AppRopio
protected virtual void ExecuteCommandOnItem(ICommand command, object dataContext)
{
if (command == null)
return;
var item = dataContext;
if (item == null)
return;
if (!command.CanExecute(item))
return;
command.Execute(item);
}
19
Source : ARViewPager.cs
with Apache License 2.0
from AppRopio
with Apache License 2.0
from AppRopio
protected virtual void ExecuteCommand(ICommand command, object parameter)
{
if (command == null)
return;
if (!command.CanExecute(parameter))
return;
command.Execute(parameter);
}
19
Source : CommonMapFragment.cs
with Apache License 2.0
from AppRopio
with Apache License 2.0
from AppRopio
public virtual bool OnMarkerClick(Marker marker)
{
try
{
MarkerClick?.Execute(MarkerSet.GetRawItem(marker));
return true;
}
catch
{
}
return false;
}
19
Source : CommonMapFragment.cs
with Apache License 2.0
from AppRopio
with Apache License 2.0
from AppRopio
public virtual void OnMapClick(LatLng point)
{
try
{
MarkerClick?.Execute(null);
}
catch { }
}
19
Source : BindableSearchBar.cs
with Apache License 2.0
from AppRopio
with Apache License 2.0
from AppRopio
private void OnSearch(object sender, EventArgs e)
{
ResignFirstResponder();
if (SearchCommand != null)
SearchCommand.Execute(Text);
}
19
Source : BindableSearchController.cs
with Apache License 2.0
from AppRopio
with Apache License 2.0
from AppRopio
private void OnSearch(object sender, EventArgs e)
{
ResignFirstResponder();
if (SearchCommand != null)
SearchCommand.Execute(SearchBar.Text);
}
19
Source : BindableMKMapView.cs
with Apache License 2.0
from AppRopio
with Apache License 2.0
from AppRopio
protected void OnItemSelected(T item)
{
SelectedItem = item;
if (SelectionChangedCommand != null && SelectionChangedCommand.CanExecute(item))
SelectionChangedCommand.Execute(item);
}
19
Source : BasketTableSource.cs
with Apache License 2.0
from AppRopio
with Apache License 2.0
from AppRopio
public override void CommitEditingStyle(UITableView tableView, UITableViewCellEditingStyle editingStyle, NSIndexPath indexPath)
{
if (editingStyle == UITableViewCellEditingStyle.Delete && DeleteItemCommand != null)
{
var item = GereplacedemAt(indexPath) as IBaskereplacedemVM;
if (item != null && DeleteItemCommand.CanExecute(item))
DeleteItemCommand.Execute(item);
}
}
19
Source : LinkerPleaseInclude.cs
with Apache License 2.0
from AppRopio
with Apache License 2.0
from AppRopio
public void Include(ICommand command)
{
command.CanExecuteChanged += (s, e) => { if (command.CanExecute(null)) command.Execute(null); };
}
19
Source : MainViewModel.cs
with MIT License
from aritchie
with MIT License
from aritchie
public async void OnAppearing()
{
this.LoadJobs.Execute(null);
this.LoadLogs.Execute(null);
this.jobManager.JobStarted += this.OnJobStarted;
this.jobManager.JobFinished += this.OnJobFinished;
this.HasPermissions = await this.jobManager.HasPermissions();
}
19
Source : MainViewModel.cs
with MIT License
from aritchie
with MIT License
from aritchie
void OnJobFinished(object sender, JobRunResult args)
{
if (args.Success)
this.dialogs.Toast($"Job {args.Job.Name} Finished");
else
this.dialogs.Alert(args.Exception.ToString(), $"Job {args.Job.Name} Failed");
this.LoadLogs.Execute(null);
this.LoadJobs.Execute(null);
}
19
Source : MainViewModel.cs
with MIT License
from aritchie
with MIT License
from aritchie
async Task PurgeLogs(bool all)
{
TimeSpan? age = null;
if (!all)
age = TimeSpan.FromHours(8);
var msg = all ? "Are you sure you wish to purge all logs?" : "Do you want to purge logs older than 8 hours";
var confirm = await this.dialogs.ConfirmAsync(msg);
if (confirm)
{
this.jobManager.PurgeLogs(null, age);
this.LoadLogs.Execute(null);
}
}
19
Source : eliteButtonOutline.cs
with MIT License
from arqueror
with MIT License
from arqueror
private void OnButtonLongClick()
{
this.ButtonLongClick?.Invoke(this, EventArgs.Empty);
ButtonLongClickCommand?.Execute(null);
}
19
Source : eliteColorCollection.cs
with MIT License
from arqueror
with MIT License
from arqueror
public void OnColorShapeClick(eliteColorShape colorShape)
{
this.ColorShapeClick?.Invoke(colorShape, EventArgs.Empty);
ColorShapeClickCommand?.Execute(colorShape);
}
19
Source : eliteSlider.cs
with MIT License
from arqueror
with MIT License
from arqueror
private void OnValueChanged(int currentValue)
{
decimal onePercentInValue = this.MaxValue / 100m;
decimal percentInValue = onePercentInValue * currentValue;
if (percentInValue >= this.MaxValue)
percentInValue = this.MaxValue;
else if (percentInValue <= this.MinValue)
percentInValue = this.MinValue;
this.CurrentValue = (int)percentInValue;
this.ValueChanged?.Invoke(this, new EventArgsSliderValueChanged()
{
CurrentValue = this.CurrentValue
});
ValueChangedCommand?.Execute(CurrentValue);
}
19
Source : eliteButton.cs
with MIT License
from arqueror
with MIT License
from arqueror
private void OnButtonClick()
{
this.ButtonClick?.Invoke(this, EventArgs.Empty);
ButtonClickCommand?.Execute(null);
}
19
Source : eliteCircleImages.cs
with MIT License
from arqueror
with MIT License
from arqueror
public void OnCircleImageClick(eliteCircleImageShape circleImage)
{
this.CircleImageClick?.Invoke(circleImage, EventArgs.Empty);
CircleImageClickCommand?.Execute(circleImage);
}
19
Source : eliteSwitch.cs
with MIT License
from arqueror
with MIT License
from arqueror
private void OnToggled()
{
Toggled?.Invoke(this, SwitchToggled);
if (ToggledCommand != null)
ToggledCommand.Execute(SwitchToggled);
}
19
Source : eliteTabsRound.cs
with MIT License
from arqueror
with MIT License
from arqueror
private void OnTabChanged()
{
this.TabChanged?.Invoke(this, new EventArgsTabChanged()
{
tabSelected = this.tabItemSelected
});
TabChangedCommand?.Execute(this.tabItemSelected);
}
19
Source : RadialMenu.xaml.cs
with MIT License
from arqueror
with MIT License
from arqueror
private void HandleChildOptionClicked(RadialMenuItem parenreplacedem, Enumerations.Enumerations.RadialMenuLocation value)
{
parenreplacedem.GestureRecognizers.Clear();
parenreplacedem.GestureRecognizers.Add(new TapGestureRecognizer()
{
Command = new Command(async () =>
{
//IsOpened = false;
ChildItemTapped?.Invoke(this, new Models.ChildItemTapped() { Parent = ParentInBackgroundItem, ItemTapped = value });
ChildItemTappedCommand?.Execute( new Models.ChildItemTapped() { Parent = ParentInBackgroundItem, ItemTapped = value });
if (CloseMenuWhenChildTapped)
{
IsOpened = false;
IsChildItemOpened = false;
if (!_isAnimating)
{
_isAnimating = true;
InnerButtonMenu.IsVisible = true;
InnerButtonClose.IsVisible = false;
BackButton.IsVisible = true;
await HideButtons(ParentInBackgroundItem.ChildItems);
InnerButtonClose.RotateTo(0, _animationDelay);
InnerButtonClose.FadeTo(0, _animationDelay);
BackButton.RotateTo(0, _animationDelay);
BackButton.FadeTo(0, _animationDelay);
InnerButtonMenu.RotateTo(0, _animationDelay);
InnerButtonMenu.FadeTo(1, _animationDelay);
ClearGridButtons();
await OuterCircle.ScaleTo(1, (uint)MenuCloseAnimationDuration, MenuCloseEasing);
InnerButtonClose.IsVisible = false;
BackButton.IsVisible = false;
BackButton.GestureRecognizers.Clear();
InnerButtonMenu.GestureRecognizers.Clear();
InnerButtonClose.GestureRecognizers.Clear();
HandleMenuCenterClicked();
HandleCloseClicked();
foreach (var i in MenuItemsSource)
{
var item = i as RadialMenuItem;
//OrganizeItem(item);
mainGrid.Children.Add(item);
//HandleOptionClicked(item, item.Location);
}
_isAnimating = false;
}
}
else
{
GoBack();
}
}),
NumberOfTapsRequired = 1
});
}
19
Source : RadialMenu.xaml.cs
with MIT License
from arqueror
with MIT License
from arqueror
private void HandleOptionClicked(RadialMenuItem item, Enumerations.Enumerations.RadialMenuLocation value)
{
item.GestureRecognizers.Clear();
item.GestureRecognizers.Add(new TapGestureRecognizer()
{
Command = new Command(async () =>
{
ParentInBackgroundItem = item;
ItemTapped?.Invoke(this, value);
ItemTappedCommand?.Execute(value);
if (item.ChildItems?.Count > 0)
{
IsChildItemOpened = true;
await HideButtons(ParentInBackgroundItem.ChildItems);
CloseMenu(item);//Navigate to submenu
}
else
{
IsOpened = false;
IsChildItemOpened = false;
CloseMenu();
}
}),
NumberOfTapsRequired = 1
});
}
19
Source : PaginationListView.xaml.cs
with Apache License 2.0
from artemshuba
with Apache License 2.0
from artemshuba
private void ListView_ItemClick(object sender, ItemClickEventArgs e)
{
ItemClickCommand?.Execute(e.ClickedItem);
}
19
Source : SearchBox.cs
with Apache License 2.0
from artemshuba
with Apache License 2.0
from artemshuba
protected override void OnKeyUp(KeyRoutedEventArgs e)
{
base.OnKeyUp(e);
if (e.Key == VirtualKey.Enter && !string.IsNullOrWhiteSpace(Text))
{
SearchCommand?.Execute(Text);
}
}
19
Source : AudioPostControl.xaml.cs
with Apache License 2.0
from artemshuba
with Apache License 2.0
from artemshuba
private void TracksListView_ItemClick(object sender, ItemClickEventArgs e)
{
var track = (IAudio)e.ClickedItem;
var container = new AudioContainer() { Track = track, Tracklist = AudioPost.Tracks };
if (Command?.CanExecute(container) == true)
Command?.Execute(container);
}
19
Source : AudioPostControl.xaml.cs
with Apache License 2.0
from artemshuba
with Apache License 2.0
from artemshuba
private void AuthorNameButton_Click(object sender, RoutedEventArgs e)
{
if (AuthorCommand?.CanExecute(AudioPost) == true)
AuthorCommand?.Execute(AudioPost);
}
19
Source : AudioPostControl.xaml.cs
with Apache License 2.0
from artemshuba
with Apache License 2.0
from artemshuba
private void PostDateButton_Click(object sender, RoutedEventArgs e)
{
if (PostCommand?.CanExecute(AudioPost) == true)
PostCommand?.Execute(AudioPost);
}
19
Source : TrackControl.xaml.cs
with Apache License 2.0
from artemshuba
with Apache License 2.0
from artemshuba
private void TrackControl_OnTapped(object sender, TappedRoutedEventArgs e)
{
if (Command?.CanExecute(CommandParameter) == true)
Command?.Execute(CommandParameter);
}
19
Source : eliteCheckbox.cs
with MIT License
from arqueror
with MIT License
from arqueror
private void OnChecked()
{
this.Checked?.Invoke(this, EventArgs.Empty);
CheckedCommand?.Execute(true);
}
19
Source : eliteCheckbox.cs
with MIT License
from arqueror
with MIT License
from arqueror
private void OnUnchecked()
{
this.Unchecked?.Invoke(this, EventArgs.Empty);
CheckedCommand?.Execute(false);
}
19
Source : eliteColorPicker.cs
with MIT License
from arqueror
with MIT License
from arqueror
protected override void OnPaintSurface(SKPaintSurfaceEventArgs e)
{
var info = e.Info;
var surface = e.Surface;
var canvas = surface.Canvas;
canvas.Clear();
Radius = (int)((WidthRequest ) + (Math.Pow(HeightRequest, 2)) / (8 * WidthRequest)) ;
MarkerRadius = Radius /15;
_center = new SKPoint(info.Rect.MidX, info.Rect.MidY);
_circlePalette.Shader = SKShader.CreateSweepGradient(_center, _colors, null);
canvas.DrawCircle(_center, Radius - _circlePalette.StrokeWidth, _circlePalette);
SKPaint paint = new SKPaint
{
Style = SKPaintStyle.Stroke,
Color = _selectedColor,
StrokeWidth = 15,
IsAntialias = true
};
canvas.DrawCircle(_center, (Radius - _circlePalette.StrokeWidth) + (_circlePalette.StrokeWidth / 2 + 15), paint);
if (_touchLocation == SKPoint.Empty)
{
_touchLocation = _center;
_colorChanged = true;
}
if (_colorChanged)
{
using (var bmp = new SKBitmap(info))
{
IntPtr dstpixels = bmp.GetPixels();
var succeed = surface.ReadPixels(info, dstpixels, info.RowBytes, (int)_touchLocation.X, (int)_touchLocation.Y);
if (succeed)
{
_selectedColor = bmp.GetPixel(0, 0);
ColorChanged?.Invoke(this, new EventArgsColorChanged(_selectedColor.ToFormsColor()));
ColorChangedCommand?.Execute(_selectedColor.ToFormsColor());
}
}
}
//If user started moving marker Draw little circle in new position
if (!_isFirstTime)
{
_touchCircleOutline.Color = MarkerColor.ToSKColor();
canvas.DrawCircle(_touchLocation, MarkerRadius, _touchCircleOutline);
}
}
19
Source : eliteNumberCounter.cs
with MIT License
from arqueror
with MIT License
from arqueror
private void OnValueChanged()
{
this.ValueChanged?.Invoke(this, EventArgs.Empty);
ValueChangedCommand?.Execute(CurrentValue);
}
19
Source : elitePulseIcon.cs
with MIT License
from arqueror
with MIT License
from arqueror
private void iconTouched(object eventSender, SKTouchEventArgs eventArgs)
{
switch (eventArgs.ActionType)
{
case SKTouchAction.Released:
ButtonClick?.Invoke(this, null);
ButtonClickCommand?.Execute(null);
break;
}
eventArgs.Handled = true;
}
19
Source : eliteRadiobutton.cs
with MIT License
from arqueror
with MIT License
from arqueror
private void OnSelected()
{
this.Selected?.Invoke(this, EventArgs.Empty);
RadioButtonSelectedCommand?.Execute(true);
}
19
Source : eliteRadiobutton.cs
with MIT License
from arqueror
with MIT License
from arqueror
private void OnUnselected()
{
this.Unselected?.Invoke(this, EventArgs.Empty);
RadioButtonUnselectedCommand?.Execute(false);
}
19
Source : ControlDoubleClickBehavior.cs
with GNU General Public License v2.0
from Asixa
with GNU General Public License v2.0
from Asixa
static void control_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
if(sender is Control control)
{
var command = control.GetValue(ExecuteCommand) as ICommand;
var commandParameter = control.GetValue(ExecuteCommandParameter);
if (command.CanExecute(e))
{
command.Execute(commandParameter);
}
}
}
19
Source : ChildWindow.cs
with GNU General Public License v3.0
from atomex-me
with GNU General Public License v3.0
from atomex-me
public bool Close(object childWindowResult = null)
{
// check if we really want close the dialog
var e = new CancelEventArgs();
OnClosing(e);
if (!e.Cancel)
{
// now handle the command
if (ClosingButtonCommand != null)
{
var parameter = ClosingButtonCommandParameter ?? this;
if (!ClosingButtonCommand.CanExecute(parameter))
return false;
ClosingButtonCommand.Execute(parameter);
}
ChildWindowResult = childWindowResult;
IsOpen = false;
return true;
}
return false;
}
19
Source : AyFormSubmit.cs
with MIT License
from ay2015
with MIT License
from ay2015
protected override void Invoke(object parameter)
{
if (Form.IsNotNull())
{
if (ScrollViewer != null)
{
var _curForm = Form as FrameworkElement;
var _1 = AyForm.Forms[_curForm];
bool hasFalse = false;
foreach (var item in _1)
{
var _2 = item as IAyValidate;
if (_2.IsNotNull())
{
var _3 = _2.ValidateButNotShowError();
if (!_3)
{
hasFalse = true;
var currentScrollPosition = ScrollViewer.VerticalOffset;
var point = new Point(0, currentScrollPosition);
// 计算出目标位置并滚动
var targetPosition = item.TransformToVisual(ScrollViewer).Transform(point);
ScrollViewer.ScrollToVerticalOffset(targetPosition.Y);
templi = _2;
if (_ShowErrorTime == null)
{
_ShowErrorTime = new AyTimeSetTimeout(100, () =>
{
templi.ShowError();
});
}
_ShowErrorTime.Start();
break;
}
}
}
if (hasFalse)
{
return;
}
if (Submit != null)
{
Submit(true, new RoutedEventArgs() { });
}
if (SubmitCommand != null)
{
SubmitCommand.Execute(true);
}
}
else
{
var _curForm = Form as FrameworkElement;
var _1 = AyForm.Forms[_curForm];
bool hasFalse = false;
foreach (var item in _1)
{
var _2 = item as IAyValidate;
if (_2.IsNotNull())
{
var _3 = _2.Validate();
if (!_3)
{
hasFalse = true;
break;
}
}
}
if (hasFalse)
{
return;
}
if (Submit != null)
{
Submit(true, new RoutedEventArgs() { });
}
if (SubmitCommand != null)
{
SubmitCommand.Execute(true);
}
}
}
}
19
Source : AyFilePicker.cs
with MIT License
from ay2015
with MIT License
from ay2015
protected override void Invoke(object parameter)
{
if (MaxFileCount > 0 && CurrentFileCount >= MaxFileCount)
{
apErrorToolTip.IsOpen = true;
_tb.Text = "最多只能选择" + MaxFileCount + "个文件";
AyTime.setTimeout(3000, () =>
{
apErrorToolTip.IsOpen = false;
});
return;
}
var d = new System.Windows.Forms.OpenFileDialog();
if (DefaultFolderPath.IsNotNull())
{
d.InitialDirectory = DefaultFolderPath;
}
d.Multiselect = IsMultiply;
if (FileExtensionMappers.ContainsKey(FileExtension))
{
d.Filter = FileExtensionMappers[FileExtension];
}
else
{
d.Filter = FileExtension;
}
if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
if (IsMultiply == false)
{
string filePath = d.FileName;
FileInfo fi = new FileInfo(filePath);
if (MaxFileLength > 0 && fi.Length > MaxFileLength)
{
MessageBox.Show("你选择的文件过大,目前仅支持小于" + GetSize(MaxFileLength) + "的文件", "文件选择错误");
return;
}
if (Selected != null)
{
Selected(filePath, new RoutedEventArgs() { });
}
if (SelectedCommand != null)
{
SelectedCommand.Execute(filePath);
}
if (Target.IsNotNull())
{
var _11 = Target as TextBox;
if (_11 != null)
{
_11.Text = System.IO.Path.GetFileName(filePath);
}
else
{
var _12 = Target as TextBlock;
if (_12.IsNotNull())
{
_12.Text = System.IO.Path.GetFileName(filePath);
}
else
{
var _13 = Target as Label;
if (_13.IsNotNull())
{
_13.Content = System.IO.Path.GetFileName(filePath);
}
}
}
}
}
else
{
string[] filePaths = d.FileNames;
bool hasNo = false;
if (MaxFileLength > 0)
{
foreach (var filePath in filePaths)
{
FileInfo fi = new FileInfo(filePath);
if (fi.Length > MaxFileLength)
{
MessageBox.Show("你选择的文件中有文件过大,目前仅支持小于" + GetSize(MaxFileLength) + "的文件。\r\n" + fi.Name + "(" + GetSize(fi.Length) + ")", "文件选择错误");
hasNo = true;
break;
}
}
}
if (hasNo)
{
return;
}
if (Selected != null)
{
Selected(filePaths, new RoutedEventArgs() { });
}
if (SelectedCommand != null)
{
SelectedCommand.Execute(filePaths);
}
if (Target.IsNotNull())
{
var _11 = Target as TextBox;
if (_11 != null)
{
_11.Text = GetFIleNameList(filePaths);
}
else
{
var _12 = Target as TextBlock;
if (_12.IsNotNull())
{
_12.Text = GetFIleNameList(filePaths);
}
else
{
var _13 = Target as Label;
if (_13.IsNotNull())
{
_13.Content = GetFIleNameList(filePaths);
}
}
}
}
}
}
//arl.FileLength = fi.Length;
//arl.FilePath = filePath;
//arl.FileName = System.IO.Path.GetFileName(filePath);
//arl.Duration = AyExtension.GetGuidNoSplit;
}
19
Source : AyFolderPicker.cs
with MIT License
from ay2015
with MIT License
from ay2015
protected override void Invoke(object parameter)
{
var d = new System.Windows.Forms.FolderBrowserDialog();
if (DefaultPath.IsNotNull())
{
d.SelectedPath = AyFuncIO.Instance.GetDirectory(DefaultPath);
}
d.ShowNewFolderButton = true;
d.Description = Description;
if (d.ShowDialog() == Winform.DialogResult.OK)
{
string dirPath = d.SelectedPath;
string diskNumber = dirPath[0].ToString();
double creplacedage = AyFuncDisk.Instance.GetHardDiskFreeSpace1(diskNumber);//单位B
double totalUsage = AyFuncDisk.Instance.GetHardDiskSpace1(diskNumber);//单位B
if (MinSpaceUsage.HasValue && MinSpaceUsage.Value > creplacedage)
{
apErrorToolTip.IsOpen = true;
_tb.Text = "磁盘可用空间不足,至少需要" + AyFuncDisk.Instance.GetFileOrDirectoryFormatedSize(MinSpaceUsage.Value) + "可用空间";
AyTime.setTimeout(3000, () =>
{
apErrorToolTip.IsOpen = false;
});
return;
}
SelectTotalFolderCapacity = totalUsage;
SelectFolderCapacity = creplacedage;
var _1 = TotalSizeStringFormat.StringFormat(AyFuncDisk.Instance.GetFileOrDirectoryFormatedSize(totalUsage));
var _2 = SizeStringFormat.StringFormat(AyFuncDisk.Instance.GetFileOrDirectoryFormatedSize(creplacedage));
if (SizeTarget.IsNotNull())
{
var _11 = SizeTarget as TextBox;
if (_11 != null)
{
_11.Text = _2;
}
else
{
var _12 = SizeTarget as TextBlock;
if (_12.IsNotNull())
{
_12.Text = _2;
}
else
{
var _13 = SizeTarget as Label;
if (_13.IsNotNull())
{
_13.Content = _2;
}
}
}
}
if (TotalSizeTarget.IsNotNull())
{
var _11 = TotalSizeTarget as TextBox;
if (_11 != null)
{
_11.Text = _1;
}
else
{
var _12 = TotalSizeTarget as TextBlock;
if (_12.IsNotNull())
{
_12.Text = _1;
}
else
{
var _13 = TotalSizeTarget as Label;
if (_13.IsNotNull())
{
_13.Content = _1;
}
}
}
}
if (Selected != null)
{
Selected(dirPath, new RoutedEventArgs() { });
}
if (SelectedCommand != null)
{
SelectedCommand.Execute(dirPath);
}
if (Target.IsNotNull())
{
var _11 = Target as TextBox;
if (_11 != null)
{
_11.Text = dirPath;
}
else
{
var _12 = Target as TextBlock;
if (_12.IsNotNull())
{
_12.Text = dirPath;
}
else
{
var _13 = Target as Label;
if (_13.IsNotNull())
{
_13.Content = dirPath;
}
}
}
}
}
}
19
Source : Selector.cs
with MIT License
from ay2015
with MIT License
from ay2015
protected virtual void OnSelectedItemsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
if (_ignoreSelectedItemsCollectionChanged <= 0)
{
if (e.Action == NotifyCollectionChangedAction.Reset && _internalSelectedItems != null)
{
object[] internalSelectedItems = _internalSelectedItems;
foreach (object obj in internalSelectedItems)
{
OnItemSelectionChanged(new ItemSelectionChangedEventArgs(ItemSelectionChangedEvent, this, obj, false));
if (Command != null)
{
Command.Execute(obj);
}
}
}
if (e.OldItems != null)
{
foreach (object oldItem in e.OldItems)
{
OnItemSelectionChanged(new ItemSelectionChangedEventArgs(ItemSelectionChangedEvent, this, oldItem, false));
if (Command != null)
{
Command.Execute(oldItem);
}
}
}
if (e.NewItems != null)
{
foreach (object newItem in e.NewItems)
{
OnItemSelectionChanged(new ItemSelectionChangedEventArgs(ItemSelectionChangedEvent, this, newItem, true));
if (Command != null)
{
Command.Execute(newItem);
}
}
}
UpdateFromSelectedItems();
}
}
19
Source : Util.cs
with MIT License
from ay2015
with MIT License
from ay2015
public static void ExecuteIfEnabled(this ICommand command, object commandParameter, IInputElement target)
{
if (command == null) return;
RoutedCommand rc = command as RoutedCommand;
if (rc != null)
{
//routed commands work on a target
if (rc.CanExecute(commandParameter, target)) rc.Execute(commandParameter, target);
}
else if (command.CanExecute(commandParameter))
{
command.Execute(commandParameter);
}
}
19
Source : ThumbButtonInfo.cs
with MIT License
from ay2015
with MIT License
from ay2015
private void _InvokeCommand()
{
ICommand command = Command;
if (command != null)
{
object parameter = CommandParameter;
IInputElement target = CommandTarget;
RoutedCommand routedCommand = command as RoutedCommand;
if (routedCommand != null)
{
if (routedCommand.CanExecute(parameter, target))
{
routedCommand.Execute(parameter, target);
}
}
else if (command.CanExecute(parameter))
{
command.Execute(parameter);
}
}
}
19
Source : InvokeCommandAction.cs
with MIT License
from ay2015
with MIT License
from ay2015
protected override void Invoke(object parameter)
{
if (base.replacedociatedObject != null)
{
ICommand command = ResolveCommand();
if (command != null && command.CanExecute(CommandParameter))
{
command.Execute(CommandParameter);
}
}
}
See More Examples