This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Покрасить элеменет | |
public void ChangeColorInIfc(string currentColor, IfcProduct ifcProd) | |
{ | |
int entityLabel = ifcProd.EntityLabel; | |
//Метод сохранения | |
//Передаваться будет только выбранный цвет из Dictionary StatusColors | |
using (var txn = Model.BeginTransaction("Set Style")) | |
{ | |
//Получаем сет CSoft_Colors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Windows; | |
using System.Windows.Input; | |
using System.Windows.Media; | |
using System.Windows.Shapes; | |
using TDMS3DControl.Commands; | |
using TDMS3DControl.Models; | |
using TDMS3DControl.Views; | |
namespace TDMS3DControl.ViewModels |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var startTime = System.Diagnostics.Stopwatch.StartNew(); | |
//Выполняемый код | |
startTime.Stop(); | |
var resultTime = startTime.Elapsed; | |
var elapsedTime = $"{resultTime.Hours:00}:{resultTime.Minutes:00}:{resultTime.Seconds:00}.{resultTime.Milliseconds:000}"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Style x:Key="TransparentStyle" TargetType="{x:Type Button}"> | |
<Setter Property="Template"> | |
<Setter.Value> | |
<ControlTemplate TargetType="Button" > | |
<Border Background="Transparent" Name="Border" > | |
<ContentPresenter/> | |
</Border> | |
<ControlTemplate.Triggers> | |
<Trigger Property="IsMouseOver" Value="True"> | |
<Setter TargetName="Border" Property="Background" Value="#FF8CB3EE"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Style x:Key="TransparentStyleToggle" TargetType="{x:Type ToggleButton}"> | |
<Setter Property="Template"> | |
<Setter.Value> | |
<ControlTemplate TargetType="ToggleButton" > | |
<Border Background="Transparent" Name="Border" > | |
<ContentPresenter/> | |
</Border> | |
<ControlTemplate.Triggers> | |
<Trigger Property="IsMouseOver" Value="True"> | |
<Setter TargetName="Border" Property="Background" Value="#FF8CB3EE"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MainViewModel : BaseViewModel | |
{ | |
private CancellationTokenSource cancellation; | |
#region mvvm | |
private string _text; | |
public string Text | |
{ | |
get => _text; | |
set |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//public int TimeSlider { get; set; } | |
//public int TimeSliderCurrent { get; set; } | |
//public List<ModelVisual3D> History { get; set; } | |
//private void TestExecute(object obj) | |
//{ | |
// TimeSliderCurrent = 0; | |
// History = new List<ModelVisual3D>(); | |
// var modelVisual = _styler.CommonShapes.Children.FirstOrDefault() as ModelVisual3D; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<TabControl Grid.Row="0" ItemsSource="{Binding Models}" SelectedItem="{Binding CurrentTab, Mode=TwoWay}" Loaded="FrameworkElement_OnLoaded" > | |
<i:Interaction.Triggers> | |
<i:EventTrigger EventName="SelectionChanged"> | |
<ei:CallMethodAction MethodName="Selector_OnSelectionChanged" TargetObject="{Binding}"/> | |
</i:EventTrigger> | |
</i:Interaction.Triggers> | |
<TabControl.ItemTemplate> | |
<DataTemplate> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Опсиание класса UsbListener | |
//https://gist.github.com/SpacePurr/c35aa79e8d702b5d639cef05f05f188c | |
//Основной принцип работы: | |
// 1. Создание объекта класса UsbListener | |
// 2. Подписка на эвенты событий подключения/отключения Usb устройств | |
// 3. Запуск слушателя с помощью метода Start | |
// 4. Остановка слушателя с помощью метода Stop | |
//Нюансы: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Файл содержит в себе 3 класса | |
// 1. UsbListener | |
// 2. DeviceChangedEventArgs | |
// 3. EventType | |
//EventType - набор типов событий. | |
//DeviceChangedEventArgs - класс, содержащий данные события. Наследуется от EventArgs и | |
// содержит в себе информацию класса EventArrivedEventArgs в более удобном виде. |
OlderNewer