void OnReadonlyStateChanged(ReadOnlyState state) { if (null != this.propertyInspector) { this.propertyInspector.IsReadOnly = state.IsReadOnly; } }
private void OnGotTextBlockFocus(object sender, RoutedEventArgs e) { if (Context == null) { return; } DesignerView designerView = Context.Services.GetService <DesignerView>(); if (!designerView.IsMultipleSelectionMode) { TextBlock textBlock = sender as TextBlock; bool isInReadOnlyMode = IsReadOnly; if (Context != null) { ReadOnlyState readOnlyState = Context.Items.GetValue <ReadOnlyState>(); isInReadOnlyMode |= readOnlyState.IsReadOnly; } if (null != textBlock) { BlockHeight = textBlock.ActualHeight; BlockHeight = Math.Max(BlockHeight, textBlock.MinHeight); BlockHeight = Math.Min(BlockHeight, textBlock.MaxHeight); BlockWidth = textBlock.ActualWidth; BlockWidth = Math.Max(BlockWidth, textBlock.MinWidth); BlockWidth = Math.Min(BlockWidth, textBlock.MaxWidth); // If it's already an editor, don't need to switch it/reload it (don't create another editor/grid if we don't need to) // Also don't create editor when we are in read only mode if (ContentTemplate.Equals((DataTemplate)FindResource("textblock")) && !isInReadOnlyMode) { if (Context != null) { // Get the ExpressionEditorService ExpressionEditorService1 = Context.Services.GetService <IExpressionEditorService>(); } // If the service exists, use the editor template - else switch to the textbox template if (ExpressionEditorService1 != null) { ContentTemplate = (DataTemplate)FindResource("expressioneditor"); } } } if (!isInReadOnlyMode) { //disable the error icon StartValidator(); EditingState = EditingState.Editing; e.Handled = true; } } }
private void OnReadOnlyStateChanged(ReadOnlyState state) { if (this.floatingAnnotation != null) { this.floatingAnnotation.IsReadOnly = state.IsReadOnly; } if (this.dockedAnnotation != null) { this.dockedAnnotation.IsReadOnly = state.IsReadOnly; } }
public static bool AllowDrop(IDataObject draggedDataObject, EditingContext context, params Type[] allowedItemTypes) { if (draggedDataObject == null) { throw FxTrace.Exception.ArgumentNull("draggedDataObject"); } if (context == null) { throw FxTrace.Exception.ArgumentNull("context"); } if (allowedItemTypes == null) { throw FxTrace.Exception.ArgumentNull("allowedItemTypes"); } ReadOnlyState readOnlyState = context.Items.GetValue <ReadOnlyState>(); if (readOnlyState != null && readOnlyState.IsReadOnly) { return(false); } if (!AllowDrop(draggedDataObject, context)) { return(false); } List <Type> draggedTypes = GetDraggedTypes(draggedDataObject); return(draggedTypes != null && draggedTypes.Count != 0 && draggedTypes.All <Type>((p) => { for (int i = 0; i < allowedItemTypes.Length; ++i) { if (allowedItemTypes[i] == null) { throw FxTrace.Exception.ArgumentNull(string.Format(CultureInfo.InvariantCulture, "allowedItemTypes[{0}]", i)); } if (AllowDrop(p, allowedItemTypes[i])) { return true; } } return false; })); }
public async Task <DashboardState> GetState( DateTimeOffset date, UserId user, DashboardId dashboardId, ReadOnlyState state, VirtualState virtualState) { var configs = await _repository.GetUserDashboardConfigs(user); var dashboard = configs.FirstOrDefault(c => c.Id == dashboardId); var tagState = await _tagManager.GetTags(user); var assetNames = CollectAssetNames(state.Brokers.SelectMany(b => b.Inventory).ToArray(), user); var assetTags = CollectAssetTags(tagState); var virtualAssets = CollectVirtualAssets(virtualState); var dashboardTags = dashboard?.Tags ?? new List <DashboardConfigTagModel>(); _logger.LogTrace($"Dashboard {dashboardId} contains {dashboardTags.Count} tags"); var tags = dashboardTags .Select(t => { if (!assetTags.TryGetValue(new(t.Tag), out var assetIsins)) { assetIsins = Array.Empty <AssetISIN>(); } var assets = assetIsins .Where(isin => virtualAssets.Any(a => a.Isin == isin)) .Select(isin => { var name = assetNames.GetValueOrDefault(isin) ?? string.Empty; var sums = CalculateAssetSums(isin, virtualAssets, date); return(new DashboardAsset(isin, name, sums)); }) .ToArray(); var assetSums = AggregateSums(assets.Select(a => a.Sums)); return(new DashboardStateTag(t.Tag, assets, assetSums)); }) .ToArray(); var tagSums = AggregateSums(tags.Select(t => t.Sums)); return(new(tags, tagSums)); }
void OnReadOnlyStateChanged(ReadOnlyState state) { UpdateChildrenElementStatus(); }
protected override bool CanComplete() { ReadOnlyState readOnlyState = this.modelTreeManager.Context.Items.GetValue <ReadOnlyState>(); return(readOnlyState == null || !readOnlyState.IsReadOnly); }