private void dragOver(DragEventArgs e) { IDataObject dataObject = e.Data; if (dataObject == null) { return; } var data = dataObject.GetData(typeof(DraggableRowsBehavior.Data)) as DraggableRowsBehavior.Data; if (data == null) { return; } var lbItem = VisualHelpers.FindAncestor <ListBoxItem>(e.OriginalSource); if (lbItem != null) { lbItem.IsSelected = true; } // add appropriate device for mappings, if file is empty if (!Devices.Any()) { var copy = (data.SenderDataContext as DeviceViewModel).Copy(false); addDevice(copy); SelectedDevice = Devices.First(); } }
public static ColorSlider Brightness(VisualDirection direction, float knobWidth, float minVisualLength, Color color, Reaction <float> changed) { return(new ColorSlider(direction, knobWidth, minVisualLength, 0f, 1f, color.GetBrightness(), new[] { Color.Black, VisualHelpers.ColorFromHSB(color.GetHue(), color.GetSaturation(), 1f) }, changed)); }
private void ChangeHue(float hue) { int i = LastColorIndex(); _saturation.Colors[i] = VisualHelpers.ColorFromHSB(hue, 1f, 1f); _brightness.Colors[i] = VisualHelpers.ColorFromHSB(hue, _saturation.Value, 1f); UpdateValue(); }
private void ConfigureAnimations() { // TODO: collapse all this into a single helper method ElementCompositionPreview.SetIsTranslationEnabled(HostElement, true); ElementCompositionPreview.SetImplicitShowAnimation(HostElement, VisualHelpers.CreateAnimationGroup( VisualHelpers.CreateVerticalOffsetAnimationFrom(0.45, -50f), VisualHelpers.CreateOpacityAnimation(0.5))); ElementCompositionPreview.SetImplicitHideAnimation(HostElement, VisualHelpers.CreateOpacityAnimation(0.8, 0)); }
private void ConfigureAnimations() { ElementCompositionPreview.SetIsTranslationEnabled(paraimage, true); ElementCompositionPreview.SetImplicitShowAnimation(paraimage, VisualHelpers.CreateVerticalOffsetAnimationFrom(0.55, -150)); ElementCompositionPreview.SetImplicitHideAnimation(paraimage, VisualHelpers.CreateVerticalOffsetAnimationTo(0.55, -150)); ElementCompositionPreview.SetImplicitHideAnimation(paraimage, VisualHelpers.CreateOpacityAnimation(0.4, 0)); Canvas.SetZIndex(this, 1); ElementCompositionPreview.SetImplicitHideAnimation(this, VisualHelpers.CreateOpacityAnimation(0.4, 0)); }
private void EnsureElements(NavigationView navigationView) { if (_navHeaeder == null) { _navHeaeder = VisualHelpers.GetVisualChildByName <FrameworkElement>(navigationView, "HeaderContent"); } if (_menuButton == null) { _menuButton = VisualHelpers.GetVisualChildByName <FrameworkElement>(navigationView, "TogglePaneButton"); } }
private static void OnGridPreviewDragOver(object sender, DragEventArgs e) { if (_dropData == null) { return; } var adapter = GetSelectorAdapter(sender as Selector); var data = _dropData.GetData(typeof(Data)) as Data; bool sameSelectorTypes = _senderAdapter.GetType() == adapter.GetType(); if (sameSelectorTypes) { var hoveredControl = e.OriginalSource as DependencyObject; // update drag visuals var currentTargetItem = adapter.GetItem(hoveredControl); if (currentTargetItem != null) { showInsertLine(currentTargetItem, e.GetPosition(currentTargetItem).Y < currentTargetItem.ActualHeight / 4); } else { hideInsertLine(); } if (adapter.IsValidDropTarget(hoveredControl)) { e.Effects = (!isCtrlKeyPressed()) ? DragDropEffects.Move : DragDropEffects.Copy; } else { e.Effects = DragDropEffects.None; } } // scroll if necessary ScrollViewer sv = VisualHelpers.FindChild <ScrollViewer>(adapter.Selector); double verticalPos = e.GetPosition(adapter.Selector).Y; double scrollOffset = getDragScrollOffset(adapter); if (verticalPos < DRAG_SCROLL_TOLERANCE) // Top of visible list? { sv.ScrollToVerticalOffset(sv.VerticalOffset - scrollOffset); //Scroll up. } else if (verticalPos > adapter.Selector.ActualHeight - DRAG_SCROLL_TOLERANCE) //Bottom of visible list? { sv.ScrollToVerticalOffset(sv.VerticalOffset + scrollOffset); //Scroll down. } e.Handled = sameSelectorTypes; }
private void InitializeComboBox <T>(Gtk.ComboBox comboBox, IEnumerable <T> values, T activeValue, Func <T, string> toDisplayString) { var cellRenderer = new Gtk.CellRendererCombo(); comboBox.PackStart(cellRenderer, true); comboBox.SetCellDataFunc(cellRenderer, (l, e, m, i) => VisualHelpers.CellEnumRenderer <T>(l, e, m, i, toDisplayString)); var model = new Gtk.ListStore(typeof(T)); model.SynchronizeCollection(new ObservableCollection <T>(values)); comboBox.Model = model; comboBox.Active = comboBox.GetIndexOfValue(activeValue); }
public override bool IsValidDropTarget(DependencyObject control) { if (getRow(control) != null) { return(true); } // allow drop on empty selector var grid = VisualHelpers.FindAncestor <DataGrid>(control); if (grid != null && !grid.HasItems) { return(true); } return(false); }
public override bool IsValidDropTarget(DependencyObject control) { if (getListBoxItem(control) != null) { return(true); } // allow drop on empty selector var listbox = VisualHelpers.FindAncestor <ListBox>(control); if (listbox != null && !listbox.HasItems) { return(true); } return(false); }
private void ConfigureAnimations() { ElementCompositionPreview.SetIsTranslationEnabled(TitleElement, true); ElementCompositionPreview.SetImplicitShowAnimation(TitleElement, VisualHelpers.CreateAnimationGroup( VisualHelpers.CreateVerticalOffsetAnimationFrom(0.45, -50f), VisualHelpers.CreateOpacityAnimation(0.5))); Canvas.SetZIndex(this, 1); ElementCompositionPreview.SetImplicitHideAnimation(this, VisualHelpers.CreateOpacityAnimation(0.4, 0)); var contentShowAnimations = VisualHelpers.CreateVerticalOffsetAnimation(0.45, 50, 0.2); var contentOpacityAnimations = VisualHelpers.CreateOpacityAnimation(.8); ElementCompositionPreview.SetIsTranslationEnabled(ContentElement, true); ElementCompositionPreview.SetImplicitShowAnimation( ContentElement, VisualHelpers.CreateAnimationGroup(contentShowAnimations, contentOpacityAnimations)); ElementCompositionPreview.SetImplicitHideAnimation(ContentElement, VisualHelpers.CreateVerticalOffsetAnimationTo(0.4, 50)); }
private void ConfigureAnimations() { // TODO: collapse all this into a single helper method ElementCompositionPreview.SetIsTranslationEnabled(TopBorder, true); ElementCompositionPreview.SetImplicitShowAnimation(TopBorder, VisualHelpers.CreateVerticalOffsetAnimationFrom(0.45, -450f)); ElementCompositionPreview.SetImplicitHideAnimation(TopBorder, VisualHelpers.CreateVerticalOffsetAnimationTo(0.45, -30)); // ListContent: var listContentShowAnimations = VisualHelpers.CreateVerticalOffsetAnimation(0.45, 50, 0.2); var listContentOpacityAnimations = VisualHelpers.CreateOpacityAnimation(.8); ElementCompositionPreview.SetIsTranslationEnabled(ListContent, true); ElementCompositionPreview.SetImplicitShowAnimation( ListContent, VisualHelpers.CreateAnimationGroup(listContentShowAnimations, listContentOpacityAnimations)); ElementCompositionPreview.SetImplicitHideAnimation(ListContent, VisualHelpers.CreateVerticalOffsetAnimationTo(0.4, 50)); // Set Z index to force this page to the top during the hide animation Canvas.SetZIndex(this, 1); ElementCompositionPreview.SetImplicitHideAnimation(this, VisualHelpers.CreateOpacityAnimation(0.4, 0)); }
private void ConfigureAnimations() { // TODO: collapse all this into a single helper method ElementCompositionPreview.SetIsTranslationEnabled(header, true); ElementCompositionPreview.SetImplicitShowAnimation(header, VisualHelpers.CreateAnimationGroup( VisualHelpers.CreateVerticalOffsetAnimationFrom(0.45, -50f), VisualHelpers.CreateOpacityAnimation(0.5) )); ElementCompositionPreview.SetImplicitHideAnimation(header, VisualHelpers.CreateOpacityAnimation(0.8, 0)); ElementCompositionPreview.SetIsTranslationEnabled(playbackcontrolsholder, true); ElementCompositionPreview.SetImplicitShowAnimation( playbackcontrolsholder, VisualHelpers.CreateAnimationGroup(VisualHelpers.CreateVerticalOffsetAnimation(0.55, 100, 0), VisualHelpers.CreateOpacityAnimation(0.8))); ElementCompositionPreview.SetImplicitHideAnimation(playbackcontrolsholder, VisualHelpers.CreateOpacityAnimation(0.8, 0)); Canvas.SetZIndex(this, 1); ElementCompositionPreview.SetImplicitHideAnimation(this, VisualHelpers.CreateOpacityAnimation(0.8, 0)); }
private void ContainerItem_Loaded(object sender, RoutedEventArgs e) { var itemsPanel = (ItemsStackPanel)feeditems.ItemsPanelRoot; var itemContainer = (ListViewItem)sender; var itemIndex = feeditems.IndexFromContainer(itemContainer); var relativeIndex = itemIndex - itemsPanel.FirstVisibleIndex; Grid uc; if (itemContainer.ContentTemplateRoot as SwipeControl != null) { uc = (itemContainer.ContentTemplateRoot as SwipeControl).Content as Grid; } else { uc = itemContainer.ContentTemplateRoot as Grid; } if (itemContainer.Content != ViewModel.PersistedEpisode && itemIndex >= 0 && itemIndex >= itemsPanel.FirstVisibleIndex && itemIndex <= itemsPanel.LastVisibleIndex) { var itemVisual = ElementCompositionPreview.GetElementVisual(uc); ElementCompositionPreview.SetIsTranslationEnabled(uc, true); var staggerDelay = TimeSpan.FromMilliseconds(relativeIndex * 100); var offsetAnimation = VisualHelpers.CreateHorizontalOffsetAnimation(0.7, 150, staggerDelay.TotalSeconds); itemVisual.StartAnimation("Translation.X", offsetAnimation); var opacityAnimation = VisualHelpers.CreateOpacityAnimation(0.5); opacityAnimation.DelayBehavior = Windows.UI.Composition.AnimationDelayBehavior.SetInitialValueBeforeDelay; opacityAnimation.DelayTime = staggerDelay; itemVisual.StartAnimation("Opacity", opacityAnimation); } itemContainer.Loaded -= this.ContainerItem_Loaded; }
private void ConfigureAnimations() { ElementCompositionPreview.SetIsTranslationEnabled(title, true); ElementCompositionPreview.SetImplicitShowAnimation(title, VisualHelpers.CreateAnimationGroup( VisualHelpers.CreateVerticalOffsetAnimationFrom(0.45, -50f), VisualHelpers.CreateOpacityAnimation(0.5) )); // favorites listview ElementCompositionPreview.SetIsTranslationEnabled(favoriteListView, true); ElementCompositionPreview.SetImplicitShowAnimation( favoriteListView, VisualHelpers.CreateAnimationGroup( VisualHelpers.CreateVerticalOffsetAnimation(0.55, 50, 0), VisualHelpers.CreateOpacityAnimation(0.5))); ElementCompositionPreview.SetImplicitHideAnimation(favoriteListView, VisualHelpers.CreateVerticalOffsetAnimationTo(0.4, 50)); ElementCompositionPreview.SetImplicitHideAnimation(favoriteListView, VisualHelpers.CreateOpacityAnimation(0.4, 0)); Canvas.SetZIndex(this, 1); ElementCompositionPreview.SetImplicitHideAnimation(this, VisualHelpers.CreateOpacityAnimation(0.4, 0)); }
private void InitializeColorComboBox(Gtk.ComboBox colorChooser, ObservableCollection <FileNodeColorViewModel> colors, MenuLayoutViewModel dataContext) { colorChooser.SetValue(IFakeDependencyObjectHelpers.DataContextPropertyName, dataContext); colorChooser.TooltipText = MenuLayoutViewModel.ColorTip; foreach (var color in colors) { var pixbufColor = new Gdk.Pixbuf(Gdk.Colorspace.Rgb, true, 8, 14, 14); var uintColor = (uint)((color.Fill.Red & 0xFF) << 24) | (uint)((color.Fill.Green & 0xFF) << 16) | (uint)((color.Fill.Blue & 0xFF) << 8) | 0xFF; pixbufColor.Fill(uintColor); var pixbuf = new Gdk.Pixbuf(Gdk.Colorspace.Rgb, true, 8, 16, 16); pixbuf.Fill(0xFF); // black background pixbufColor.CopyArea(0, 0, 14, 14, pixbuf, 1, 1); ColorPixbufs[color.IntvColor] = pixbuf; } Gtk.CellRenderer cellRenderer = new Gtk.CellRendererPixbuf() { Xalign = 0 }; colorChooser.PackStart(cellRenderer, false); colorChooser.SetCellDataFunc(cellRenderer, (l, e, m, i) => VisualHelpers.CellImageRenderer <FileNodeColorViewModel>(l, e, m, i, c => ColorPixbufs[c.IntvColor])); cellRenderer = new Gtk.CellRendererCombo() { Xalign = 0, Xpad = 4 }; colorChooser.PackEnd(cellRenderer, true); colorChooser.SetCellDataFunc(cellRenderer, (l, e, m, i) => VisualHelpers.CellTextRenderer <FileNodeColorViewModel>(l, e, m, i, c => c.Name)); var colorListStore = new Gtk.ListStore(typeof(FileNodeColorViewModel)); colorListStore.SynchronizeCollection(colors); colorChooser.Model = colorListStore; MenuLayoutCommandGroup.SetColorCommand.CanExecuteChanged += HandleCanExecuteSetColorChanged; }
private void ChangeBrightness(float brightness) { _brightness.Colors[LastColorIndex()] = VisualHelpers.ColorFromHSB(_hue.Value, _saturation.Value, 1f); UpdateValue(); }
private void UpdateValue() { _value = VisualHelpers.ColorFromHSB(_hue.Value, _saturation.Value, _brightness.Value); Changed(_value); }
private static void OnAbout(object parameter) { // TODO: put strings in resources. var aboutDialog = new Gtk.AboutDialog(); aboutDialog.Version = SingleInstanceApplication.Version; var entryAssembly = Assembly.GetEntryAssembly(); var attribute = entryAssembly.GetCustomAttributes(typeof(AssemblyTitleAttribute), false).FirstOrDefault(); if (attribute != null) { aboutDialog.ProgramName = ((AssemblyTitleAttribute)attribute).Title; } attribute = entryAssembly.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false).FirstOrDefault(); if (attribute != null) { aboutDialog.Copyright = ((AssemblyCopyrightAttribute)attribute).Copyright; } var metadataAttributes = entryAssembly.GetCustomAttributes(typeof(AssemblyMetadataAttribute), false).Cast <AssemblyMetadataAttribute>(); // Too wordy. ////attribute = entryAssembly.GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false)[0]; ////var description = ((AssemblyDescriptionAttribute)attribute).Description; var metadataAttribute = metadataAttributes.FirstOrDefault(a => a.Key == INTV.Core.Utility.ResourceHelpers.AboutKey); var description = metadataAttribute == null ? string.Empty : metadataAttribute.Value; attribute = entryAssembly.GetCustomAttributes(typeof(AssemblyTrademarkAttribute), false).FirstOrDefault(); var trademark = attribute == null ? string.Empty : ((AssemblyTrademarkAttribute)attribute).Trademark; var comments = description; if (string.IsNullOrEmpty(comments)) { comments = trademark; } else if (!string.IsNullOrEmpty(trademark)) { comments += "\n\n" + trademark; } if (!string.IsNullOrEmpty(comments)) { aboutDialog.Comments = comments; } metadataAttribute = metadataAttributes.FirstOrDefault(a => a.Key == INTV.Core.Utility.ResourceHelpers.WebsiteKey); aboutDialog.Website = metadataAttribute == null ? "http://www.intvfunhouse.com/intvfunhouse/" : metadataAttribute.Value; metadataAttribute = metadataAttributes.FirstOrDefault(a => a.Key == INTV.Core.Utility.ResourceHelpers.WebsiteNameKey); aboutDialog.WebsiteLabel = metadataAttribute == null ? "INTV Funhouse" : metadataAttribute.Value; var authors = new List <string>(); foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) { var authorAttributes = assembly.GetCustomAttributes(typeof(AssemblyMetadataAttribute), false).Cast <AssemblyMetadataAttribute>().Where(a => a.Key == INTV.Core.Utility.ResourceHelpers.AuthorKey); authors.AddRange(authorAttributes.Select(a => a.Value)); } var weightedAuthors = authors.GroupBy(a => a); aboutDialog.Authors = weightedAuthors.Select(wa => wa.Key).ToArray(); #if SCALE_DOWN var image = SingleInstanceApplication.SplashScreenResourceType.LoadImageResource(SingleInstanceApplication.SplashScreenResource); aboutDialog.Logo = image.ScaleSimple(Convert.ToInt32(image.Width * 0.75), Convert.ToInt32(image.Height * 0.75), Gdk.InterpType.Bilinear); #else aboutDialog.Logo = SingleInstanceApplication.SplashScreenResourceType.LoadImageResource(SingleInstanceApplication.SplashScreenResource); #endif try { // BUG: Should we rely on the file being there and trust nobody hacks it? Anyone care? var programDir = SingleInstanceApplication.Instance.ProgramDirectory; var licensePath = System.IO.Path.Combine(programDir, "license.txt"); aboutDialog.License = System.IO.File.ReadAllText(licensePath); } catch (Exception) { } var result = aboutDialog.Run(); VisualHelpers.Close(aboutDialog); }
private static IDictionary <CommandLineArgument, object> GetCommandLineOptionsForRom(ProgramDescription programDescription) { var options = new Dictionary <CommandLineArgument, object>(); var forceSetting = false; var commandLineMode = CommandLineModeHelpers.FromSettingsString(Properties.Settings.Default.CommandLineMode); var customCommandLine = commandLineMode == CommandLineMode.Custom; var useRomSettingsWithCustomCommandLine = customCommandLine && Properties.Settings.Default.UseROMFeatureSettingsWithCustomCommandLine; if (customCommandLine && !string.IsNullOrWhiteSpace(Properties.Settings.Default.CustomCommandLine)) { options[CommandLineArgument.Custom] = Properties.Settings.Default.CustomCommandLine; } // EXEC ROM argument if (!customCommandLine && !string.IsNullOrWhiteSpace(Properties.Settings.Default.ExecRomPath) && ConfigurationCommandGroup.IsExecRomPathvalid(Properties.Settings.Default.ExecRomPath)) { var execPath = ConfigurationCommandGroup.ResolvePathSetting(Properties.Settings.Default.ExecRomPath); options[CommandLineArgument.ExecPath] = execPath; } // GROM ROM argument if (!customCommandLine && !string.IsNullOrWhiteSpace(Properties.Settings.Default.GromRomPath) && ConfigurationCommandGroup.IsGromRomPathValid(Properties.Settings.Default.GromRomPath)) { var gromPath = ConfigurationCommandGroup.ResolvePathSetting(Properties.Settings.Default.GromRomPath); options[CommandLineArgument.GromPath] = gromPath; } // ECS ROM argument if (!customCommandLine && !string.IsNullOrWhiteSpace(Properties.Settings.Default.EcsRomPath) && ConfigurationCommandGroup.IsEcsRomPathValid(Properties.Settings.Default.EcsRomPath)) { var ecsPath = ConfigurationCommandGroup.ResolvePathSetting(Properties.Settings.Default.EcsRomPath); options[CommandLineArgument.EcsPath] = ecsPath; } // ECS argument var enableEcs = false; forceSetting = false; switch (EnableFeatureHelpers.FromSettingString(Properties.Settings.Default.EnableEcs)) { case EnableFeature.Always: if (!customCommandLine) { enableEcs = true; } break; case EnableFeature.UseRomSetting: enableEcs = programDescription.Features.Ecs > EcsFeatures.Tolerates; if (customCommandLine) { enableEcs &= useRomSettingsWithCustomCommandLine; } break; case EnableFeature.Never: if (!customCommandLine) { forceSetting = true; } break; default: break; } if (enableEcs || forceSetting) { options[CommandLineArgument.EnableEcs] = enableEcs; } // Intellivoice argument var enableIntellivoice = false; forceSetting = false; switch (EnableFeatureHelpers.FromSettingString(Properties.Settings.Default.EnableIntellivoice)) { case EnableFeature.Always: if (!customCommandLine) { enableIntellivoice = true; } break; case EnableFeature.UseRomSetting: enableIntellivoice = programDescription.Features.Intellivoice > FeatureCompatibility.Tolerates; if (customCommandLine) { enableIntellivoice &= useRomSettingsWithCustomCommandLine; } break; case EnableFeature.Never: if (!customCommandLine) { forceSetting = true; } break; default: break; } if (enableIntellivoice || forceSetting) { options[CommandLineArgument.EnableIntellivoice] = enableIntellivoice; } // JLP argument var enableJlp = false; forceSetting = false; switch (EnableFeatureHelpers.FromSettingString(Properties.Settings.Default.EnableJlp)) { case EnableFeature.Always: if (!customCommandLine) { enableJlp = true; } break; case EnableFeature.UseRomSetting: enableJlp = programDescription.Features.Jlp > JlpFeatures.Incompatible; if (customCommandLine) { enableJlp &= useRomSettingsWithCustomCommandLine; } break; case EnableFeature.Never: default: break; } if (enableJlp) { options[CommandLineArgument.Jlp] = enableJlp; if (enableJlp && (programDescription.Features.JlpFlashMinimumSaveSectors > 0)) { var jlpSavegame = System.IO.Path.ChangeExtension(programDescription.Rom.RomPath, ProgramFileKind.SaveData.FileExtension()); options[CommandLineArgument.JlpSaveGamePath] = jlpSavegame; } } // Locutus argument if (!customCommandLine && (programDescription.Rom.Format == INTV.Core.Model.RomFormat.Luigi)) { options[CommandLineArgument.Locutus] = true; } // Mute argument if (!customCommandLine && Properties.Settings.Default.MuteAudio) { options[CommandLineArgument.AudioRate] = 0; } // Display mode and resolution arguments if (!customCommandLine) { var displayMode = DisplayMode.Default; var displayModeString = Properties.Settings.Default.DisplayMode; if (!string.IsNullOrWhiteSpace(displayModeString)) { displayMode = DisplayModeHelpers.FromSettingString(displayModeString); options[CommandLineArgument.Fullscreen] = displayMode; } if (displayMode != DisplayMode.Fullscreen) { var displaySizeString = Properties.Settings.Default.DisplaySize; if (!string.IsNullOrWhiteSpace(displaySizeString)) { options[CommandLineArgument.DisplaySize] = DisplayResolutionHelpers.FromLongCommandLineArgumentString(displaySizeString); } } else { var mainScreenInfo = VisualHelpers.GetPrimaryDisplayInfo(); var resolution = string.Format("{0}x{1},{2}bpp", mainScreenInfo.Item1, mainScreenInfo.Item2, mainScreenInfo.Item3); options[CommandLineArgument.DisplaySize] = resolution; } } // Keyboard hackfile argument if (!customCommandLine && !string.IsNullOrWhiteSpace(Properties.Settings.Default.DefaultKeyboardConfigPath)) { var hackfile = ConfigurationCommandGroup.ResolvePathSetting(Properties.Settings.Default.DefaultKeyboardConfigPath); if (ConfigurationCommandGroup.IsPathValid(hackfile)) { options[CommandLineArgument.KeyboardHackFile] = hackfile; } } // Keyboard map argument if (!customCommandLine) { var keyboardMap = KeyboardMapHelpers.FromSettingString(Properties.Settings.Default.InitialKeyboardMap); if (Properties.Settings.Default.UseEcsKeymapForEcsRoms && (programDescription.Features.Ecs > EcsFeatures.Tolerates)) { keyboardMap = KeyboardMap.EcsKeyboard; } if (keyboardMap != KeyboardMap.Default) { options[CommandLineArgument.KeyboardMap] = keyboardMap; } } // Joystick configuration file arguments if (!customCommandLine) { if (!string.IsNullOrWhiteSpace(Properties.Settings.Default.Joystick0Config)) { options[CommandLineArgument.Joystick0Configuration] = Properties.Settings.Default.Joystick0Config; } if (!string.IsNullOrWhiteSpace(Properties.Settings.Default.Joystick1Config)) { options[CommandLineArgument.Joystick1Configuration] = Properties.Settings.Default.Joystick1Config; } if (!string.IsNullOrWhiteSpace(Properties.Settings.Default.Joystick2Config)) { options[CommandLineArgument.Joystick2Configuration] = Properties.Settings.Default.Joystick2Config; } if (!string.IsNullOrWhiteSpace(Properties.Settings.Default.Joystick3Config)) { options[CommandLineArgument.Joystick3Configuration] = Properties.Settings.Default.Joystick3Config; } } // Enable mouse argument if (!customCommandLine && Properties.Settings.Default.EnableMouse) { options[CommandLineArgument.EnableMouse] = true; } // Classic Game Controller configuration arguments if (!customCommandLine) { var cgcPath = string.IsNullOrWhiteSpace(Properties.Settings.Default.ClassicGameController0ConfigPath) ? string.Empty : ConfigurationCommandGroup.ResolvePathSetting(Properties.Settings.Default.ClassicGameController0ConfigPath); if (ConfigurationCommandGroup.IsPathValid(cgcPath)) { options[CommandLineArgument.ClassicGameControllerMaster] = cgcPath; } cgcPath = string.IsNullOrWhiteSpace(Properties.Settings.Default.ClassicGameController1ConfigPath) ? string.Empty : ConfigurationCommandGroup.ResolvePathSetting(Properties.Settings.Default.ClassicGameController1ConfigPath); if (ConfigurationCommandGroup.IsPathValid(cgcPath)) { options[CommandLineArgument.ClassicGameControllerEcs] = cgcPath; } } if (!customCommandLine && (commandLineMode == CommandLineMode.AutomaticWithAdditionalArguments) && !string.IsNullOrWhiteSpace(Properties.Settings.Default.AdditionalCommandLineArguments)) { options[CommandLineArgument.AdditionalArguments] = Properties.Settings.Default.AdditionalCommandLineArguments; } return(options); }
private ListBoxItem getListBoxItem(DependencyObject control) { return(VisualHelpers.FindAncestor <ListBoxItem>(control)); }
public static Color ToColor(this Vec4 vec) { return(VisualHelpers.ColorFromRGBA(vec.X, vec.Y, vec.Z, vec.W)); }
private static void SetImplicitHide(UIElement thisPtr) { ElementCompositionPreview.SetImplicitHideAnimation(thisPtr, VisualHelpers.CreateOpacityAnimation(0.4, 0)); Canvas.SetTop(thisPtr, 1); }
private DataGridRow getRow(DependencyObject control) { return(VisualHelpers.FindAncestor <DataGridRow>(control)); }
private void InitializeMenuLayout(Gtk.TreeView menuLayout, MenuLayoutViewModel dataContext) { menuLayout.SetValue(IFakeDependencyObjectHelpers.DataContextPropertyName, dataContext); var column = new Gtk.TreeViewColumn(); Gtk.CellRenderer cellRenderer = new Gtk.CellRendererPixbuf(); column.PackStart(cellRenderer, true); column.SetCellDataFunc(cellRenderer, (l, c, m, i) => VisualHelpers.CellImageColumnRenderer <FileNodeViewModel>(l, c, m, i, p => p.Icon)); ////column.Sizing = Gtk.TreeViewColumnSizing.Fixed; ////column.FixedWidth = 20; menuLayout.AppendColumn(column); column = new Gtk.TreeViewColumn() { Title = MenuLayoutViewModel.LongNameHeader }; cellRenderer = new Gtk.CellRendererText(); _longNameEditor = new TextCellInPlaceEditor(menuLayout, column, cellRenderer as Gtk.CellRendererText, FileSystemConstants.MaxLongNameLength) { IsValidCharacter = INTV.Core.Model.Grom.Characters.Contains }; _longNameEditor.EditorClosed += HandleInPlaceEditorClosed; column.PackStart(cellRenderer, true); column.SetCellDataFunc(cellRenderer, (l, c, m, i) => VisualHelpers.CellTextColumnRenderer <FileNodeViewModel>(l, c, m, i, p => p.LongName.SafeString())); column.Sizing = Gtk.TreeViewColumnSizing.Fixed; column.FixedWidth = Properties.Settings.Default.MenuLayoutLongNameColWidth; column.Resizable = true; menuLayout.AppendColumn(column); column = new Gtk.TreeViewColumn() { Title = MenuLayoutViewModel.ShortNameHeader }; cellRenderer = new Gtk.CellRendererText(); _shortNameEditor = new TextCellInPlaceEditor(menuLayout, column, cellRenderer as Gtk.CellRendererText, FileSystemConstants.MaxShortNameLength) { IsValidCharacter = INTV.Core.Model.Grom.Characters.Contains }; _shortNameEditor.EditorClosed += HandleInPlaceEditorClosed; column.PackStart(cellRenderer, true); column.SetCellDataFunc(cellRenderer, (l, c, m, i) => VisualHelpers.CellTextColumnRenderer <FileNodeViewModel>(l, c, m, i, p => p.ShortName.SafeString())); column.Sizing = Gtk.TreeViewColumnSizing.Fixed; column.FixedWidth = Properties.Settings.Default.MenuLayoutShortNameColWidth; column.Resizable = true; menuLayout.AppendColumn(column); column = new Gtk.TreeViewColumn() { Title = MenuLayoutViewModel.ManualHeader }; cellRenderer = new Gtk.CellRendererText(); column.PackStart(cellRenderer, true); column.SetCellDataFunc(cellRenderer, (l, c, m, i) => VisualHelpers.CellTextColumnRenderer <FileNodeViewModel>(l, c, m, i, GetManualColumnStringValue)); column.Sizing = Gtk.TreeViewColumnSizing.Fixed; column.FixedWidth = Properties.Settings.Default.MenuLayoutManualColWidth; column.Resizable = true; menuLayout.AppendColumn(column); column = new Gtk.TreeViewColumn() { Title = MenuLayoutViewModel.SaveDataHeader }; cellRenderer = new Gtk.CellRendererText(); column.PackStart(cellRenderer, true); ////column.SetCellDataFunc(cellRenderer, (l,c,m,i) => VisualHelpers.CellTextColumnRenderer<ProgramDescriptionViewModel>(l,c,m,i, p => p.Name)); ////column.Sizing = Gtk.TreeViewColumnSizing.Fixed; ////column.FixedWidth = Properties.Settings.Default.MenuLayoutSaveDataColWidth; column.Resizable = true; column.Visible = Properties.Settings.Default.ShowAdvancedFeatures; menuLayout.AppendColumn(column); menuLayout.HasTooltip = true; menuLayout.QueryTooltip += HandleMenuLayoutQueryTooltip; var menuLayoutStore = new Gtk.TreeStore(typeof(FileNodeViewModel)); dataContext.SynchronizeToTreeStore(menuLayoutStore); menuLayout.Model = menuLayoutStore; menuLayout.EnableModelDragSource(Gdk.ModifierType.Button1Mask, DragDropSourceEntries, Gdk.DragAction.Move); menuLayout.EnableModelDragDest(DragDropTargetEntries, Gdk.DragAction.Copy | Gdk.DragAction.Move); menuLayout.Selection.Changed += HandleSelectionChanged; dataContext.PropertyChanged += HandleMenuLayoutPropertyChanged; }
/// <inheritdoc/> protected override void OnResponse(Gtk.ResponseType response_id) { base.OnResponse(response_id); VisualHelpers.Close(this); Dispose(); }