Um unsere Webseite für Sie optimal zu gestalten und fortlaufend verbessern zu können, verwenden wir Cookies. Durch die weitere Nutzung der Webseite stimmen Sie der Verwendung von Cookies zu. Diese Seite zeigt lediglich nicht-personalisierte Werbung an, um der neuen EU-Datenschutzgrundverordnung gerecht zu werden.
Translate
Donnerstag, 31. August 2017
C# IEnumerable to ObservableCollection as extension method
using
System;
using
System.Collections.Generic;
using
System.Collections.ObjectModel;
using
System.Linq;
using
System.Text;
using
System.Threading.Tasks;
namespace
DBLayer.Extensions
{
public
static
class
IEnumerableExtensions
{
public
static
ObservableCollection<T>
ToCollection<T>(this
IEnumerable<T>
list)
{
var collection =
new
ObservableCollection<T>();
foreach (var
item in list)
collection.Add(item);
return collection;
}
}
}
C# IEnumerable to ObservableCollection as extension method
using
System;
using
System.Collections.Generic;
using
System.Collections.ObjectModel;
using
System.Linq;
using
System.Text;
using
System.Threading.Tasks;
namespace
DBLayer.Extensions
{
public
static
class
IEnumerableExtensions
{
public
static
ObservableCollection<T>
ToCollection<T>(this
IEnumerable<T>
list)
{
var collection =
new
ObservableCollection<T>();
foreach (var
item in list)
collection.Add(item);
return collection;
}
}
}
NodeMCU wrong pin mapping...
https://github.com/esp8266/Arduino/issues/584
static const uint8_t D0 = 16; static const uint8_t D1 = 5; static const uint8_t D2 = 4; static const uint8_t D3 = 0; static const uint8_t D4 = 2; static const uint8_t D5 = 14; static const uint8_t D6 = 12; static const uint8_t D7 = 13; static const uint8_t D8 = 15; static const uint8_t D9 = 3; static const uint8_t D10 = 1;
Mittwoch, 23. August 2017
Dienstag, 22. August 2017
Montag, 21. August 2017
Sonntag, 20. August 2017
Freitag, 18. August 2017
Nuget Github Shields.io custom badge for downloads counter
https://stackoverflow.com/questions/45758500/is-there-a-possibility-to-get-the-download-count-from-nuget-org-in-a-shields-io/45759319#45759319
Z.B.
[![NuGet Downloads](https://img.shields.io/nuget/dt/HaemmerElectronics.SeppPenner.Language.svg)](https://www.nuget.org/packages/HaemmerElectronics.SeppPenner.Language/)
Z.B.
[![NuGet Downloads](https://img.shields.io/nuget/dt/HaemmerElectronics.SeppPenner.Language.svg)](https://www.nuget.org/packages/HaemmerElectronics.SeppPenner.Language/)
Mittwoch, 16. August 2017
Donnerstag, 10. August 2017
Nuget-Wie erstellt man ein Paket
1. Downloaden
2. Datei "nuget.exe" in Solutionordner kopieren
3. nuget.exe spec (bzw. ./nuget.exe spec) in Shell ausführen. (In GitGui sowie Powershell ist das 2. notwendig).
4. Paketdatei wie
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<!-- The identifier that must be unique within the hosting gallery -->
<id>Contoso.Utility.UsefulStuff</id>
<!-- The package version number that is used when resolving dependencies -->
<version>1.8.3.331</version>
<!-- Authors contain text that appears directly on the gallery -->
<authors>Dejana Tesic, Rajeev Dey</authors>
<!-- Owners are typically nuget.org identities that allow gallery
users to easily find other packages by the same owners. -->
<owners>dejanatc, rjdey</owners>
<!-- License and project URLs provide links for the gallery -->
<licenseUrl>http://opensource.org/licenses/MS-PL</licenseUrl>
<projectUrl>http://github.com/contoso/UsefulStuff</projectUrl>
<!-- The icon is used in Visual Studio's package manager UI -->
<iconUrl>http://github.com/contoso/UsefulStuff/nuget_icon.png</iconUrl>
<!-- If true, this value prompts the user to accept the license when
installing the package. -->
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<!-- Any details about this particular release -->
<releaseNotes>Bug fixes and performance improvements</releaseNotes>
<!-- The description can be used in package manager UI. Note that the
nuget.org gallery uses information you add in the portal. -->
<description>Core utility functions for web applications</description>
<!-- Copyright information -->
<copyright>Copyright ©2016 Contoso Corporation</copyright>
<!-- Tags appear in the gallery and can be used for tag searches -->
<tags>web utility http json url parsing</tags>
<!-- Dependencies are automatically installed when the package is installed -->
<dependencies>
<dependency id="Newtonsoft.Json" version="9.0" />
</dependencies>
</metadata>
<!-- A readme.txt is be displayed when the package is installed -->
<files>
<file src="readme.txt" target="" />
</files>
</package>
in https://docs.microsoft.com/en-us/nuget/create-packages/creating-a-package erstellen.
5. nuget.exe pack (bzw. ./nuget.exe pack) ausführen.
In GitGui oder Powershell ist das 2. nötig.
C#-Resize images
public
Bitmap ResizeImage(Image
image, int width,
int height)
{
var destinationRectangle
= new
Rectangle(0, 0,
width, height);
var destinationImage
= new
Bitmap(width, height);
destinationImage.SetResolution(image.HorizontalResolution, image.VerticalResolution);
using (var
graphics = Graphics.FromImage(destinationImage))
{
SetGraphicsOptions(graphics);
using
(var wrapMode =
new
ImageAttributes())
{
wrapMode.SetWrapMode(WrapMode.TileFlipXY);
graphics.DrawImage(image, destinationRectangle, 0, 0, image.Width, image.Height,
GraphicsUnit.Pixel,
wrapMode);
}
}
return destinationImage;
}
private
void SetGraphicsOptions(Graphics
graphics)
{
graphics.CompositingMode =
CompositingMode.SourceCopy;
graphics.CompositingQuality =
CompositingQuality.HighQuality;
graphics.InterpolationMode =
InterpolationMode.HighQualityBicubic;
graphics.SmoothingMode =
SmoothingMode.HighQuality;
graphics.PixelOffsetMode =
PixelOffsetMode.HighQuality;
}
Mittwoch, 9. August 2017
C# Autosize columns
ContactsDataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
Excel VBA Refresh column filters.
Sub Button_RefreshFilter()
If Me.FilterMode = True Then
With Application
.EnableEvents = False
.ScreenUpdating = False
End With
With ActiveWorkbook
.CustomViews.Add ViewName:="Mine", RowColSettings:=True
Me.AutoFilterMode = False
.CustomViews("Mine").Show
.CustomViews("Mine").Delete
End With
With Application
.EnableEvents = True
.ScreenUpdating = True
End With
End If
End Sub
Dienstag, 8. August 2017
C# Embedded resources for "installer" like behaviour-Example
http://stackoverflow.com/questions/859699/how-to-add-resources-in-separate-folders
Einfach die Ordner (Und Dateien --> Bilder, SQL-Skripte, ...) in Ordner einfügen, zum Projekt hinzufügen.
Dann bei allen auf "Embedded resource" stellen:
Für SQL:
public MainWindow()
{
InitializeComponent();
string commandText;
Assembly thisAssembly = Assembly.GetExecutingAssembly();
using (Stream s = thisAssembly.GetManifestResourceStream("TestAppInstaller.Resource.Test.Test.sql"))
{
using (StreamReader sr = new StreamReader(s))
{
commandText = sr.ReadToEnd();
}
}
Debug.Print($"SQL commando: {commandText}");
}
Für Bilder:
using(Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("<root namespace for the assembly>.<folder name>.<image file name>"))
{
pictureBox1.Image = Image.FromStream(stream);
}
Für Bilder:
private
void SetRedImage()
{
this.UiThreadInvoke(() => { PictureBox_Online.Image
= GetImage("SchichtbuchPlaner2.Images.Red.ico");
});
}
private
Image GetImage(string
path)
{
using (Stream
stream = GetStream(path))
{
return
new
Icon(stream).ToBitmap();
}
}
private
Stream GetStream(string
path)
{
return
Assembly.GetExecutingAssembly().GetManifestResourceStream(path);
}
Donnerstag, 3. August 2017
Die englische Premier League-Die beste Liga der Welt?
Da erzählen die Champions League-Daten uns aber was anderes...
Abonnieren
Posts (Atom)