This file contains hidden or 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
| Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; | |
| var ci = (CultureInfo)CultureInfo.CurrentCulture.Clone(); | |
| ci.NumberFormat.NumberDecimalSeparator = "."; |
This file contains hidden or 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 (Stream stream = this.GetType().Assembly.GetManifestResourceStream("App.Resources." + "File.ext")) | |
| { | |
| if (stream == null) | |
| { | |
| throw new ArgumentException("No such resource", "File.ext"); | |
| } | |
| using (Stream output = File.OpenWrite(currentAnalysisPath + $@"\Resources\File.ext")) | |
| { | |
| stream.CopyTo(output); | |
| } |
This file contains hidden or 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 task = Task.Run(() => LongMethodAsync()); |
This file contains hidden or 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 root = new DirectoryInfo(rootPath); | |
| foreach (var file in root.GetFiles()) | |
| { | |
| File.Copy(file.FullName, "DestinationFolder\" + file.Name, true); | |
| } |
This file contains hidden or 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 static void CloneDirectory(string root, string dest) | |
| { | |
| foreach (var directory in Directory.GetDirectories(root)) | |
| { | |
| var dirName = Path.GetFileName(directory); | |
| if (!Directory.Exists(Path.Combine(dest, dirName))) | |
| { | |
| Directory.CreateDirectory(Path.Combine(dest, dirName)); | |
| } | |
| CloneDirectory(directory, Path.Combine(dest, dirName)); |
This file contains hidden or 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 static byte[] StringToByteArray(string hex) | |
| { | |
| return Enumerable.Range(0, hex.Length) | |
| .Where(x => x % 2 == 0) | |
| .Select(x => Convert.ToByte(hex.Substring(x, 2), 16)) | |
| .ToArray(); | |
| } |
This file contains hidden or 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
| string name; | |
| public string Name | |
| { | |
| get { return name; } | |
| set | |
| { | |
| name = value; | |
| OnPropertyChanged(nameof(Name)); | |
| } |
This file contains hidden or 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
| /// <summary> | |
| /// Interface for commands to use in MVVM Pattern. It implements ICommand interface. | |
| /// </summary> | |
| public class RelayCommand : ICommand | |
| { | |
| readonly Action<object> execute; | |
| readonly Func<object, bool> canExecute; | |
| /// <summary> | |
| /// CanExecuteChanged event handler. |
This file contains hidden or 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
| Application.Current.ShutdownMode = ShutdownMode.OnMainWindowClose; |
This file contains hidden or 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
| OneCommand = new RelayCommand(o => OneMethod(), o => true); |
OlderNewer