var tr = new Trapezium();
tr.x1 = ...
using System;
using System.Globalization;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
var a = "Mon May 14 14:09:14 2018 +0300";
var d = DateTime.ParseExact(a,"ddd MMM dd HH:mm:ss yyyy zzz", new CultureInfo("en-EN"));
}
}
}
using System.Collections.ObjectModel;
using System.Windows.Controls;
using System.Windows.Documents;
namespace WpfApp1
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow
{
public ObservableCollection<Log> Logs { get; set; } = new ObservableCollection<Log>();
private string _oldText = "";
private string _newText = "";
public MainWindow()
{
InitializeComponent();
DataContext = this;
}
private void RichTextBox_TextChanged(object sender, TextChangedEventArgs e)
{
_newText = new TextRange((e.Source as RichTextBox).Document.ContentStart, (e.Source as RichTextBox).Document.ContentEnd).Text;
Logs.Add(new Log { New = _newText, Old = _oldText });
_oldText = _newText;
}
public class Log
{
public string Old { get; set; }
public string New { get; set; }
}
}
}
<Window x:Class="WpfApp1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RichTextBox TextChanged="RichTextBox_TextChanged"/>
<DataGrid Grid.Row="1" ItemsSource="{Binding Logs}" AutoGenerateColumns="False">
<DataGrid.Columns>
<DataGridTextColumn Width="*" Header="Было" Binding="{Binding Old}"/>
<DataGridTextColumn Width="*" Header="Стало" Binding="{Binding New}"/>
</DataGrid.Columns>
</DataGrid>
</Grid>
</Window>
namespace TosterApp
{
class Program
{
static void Main(string[] args)
{
int input;
do Console.WriteLine("Enter number between 0 and 5:");
while (!int.TryParse(Console.ReadLine(), out input) || input <= 0 || input > 5);
Console.WriteLine($"You entered {input}");
}
}
}
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Windows.Forms;
namespace WindowsFormsApp1
{
public partial class Form1 : Form
{
public List<Country> Countries { get; set; }
public List<City> Cities { get; set; }
public Form1()
{
InitializeComponent();
Countries = new List<Country>() { new Country { Name = "Russia" }, new Country { Name = "USA" } };
Cities = new List<City>() { new City { Name = "Moscow", Country = "Russia" }, new City { Name = "St. Petersburg", Country = "Russia" }, new City { Name = "New York", Country = "USA" }, new City { Name = "Florida", Country = "USA" } };
comboBox1.DataSource = Countries;
comboBox1.DisplayMember = "Name";
comboBox2.DisplayMember = "Name";
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
comboBox2.DataSource = Cities.Where(x => x.Country == (comboBox1.SelectedValue as Country).Name).ToList();
}
}
public class Country
{
public string Name { get; set; }
}
public class City
{
public string Country { get; set; }
public string Name { get; set; }
}
}