본문 바로가기

분류 전체보기115

Bat - Path ● 파일 경로 출력 @echo on set FullPath=%0 set DriveName=%~d0 set DirPath=%~p0 set FileName=%~n0 set ExtName=%~x0 set DriveAndDirPath=%~dp0 set CurrentPath=%cd% pause 2023. 7. 17.
Bat - Time ● 현재 시간 출력 @echo on set CurDate=%date% set CurTime=%time: =0% set HH=%CurTime:~0,2% set MM=%CurTime:~3,2% set SS=%CurTime:~6,2% pause 2023. 7. 17.
Tray Icon ● Form 에 NotifyIcon 추가 ● notifyicon Visible : False (프로그램 시작시 초기에는 트레이 아이콘이 표시되지 않도록 한다.) Icon : 트레이 아이콘에 표시될 아이콘을 지정한다. DoubleClick 이벤트 추가 ● Form FormClosing 이벤트 추가 Resize 이벤트 추가 void ToTray() { this.Hide(); this.ShowIcon = false; notifyIcon.Visible = true; } void ToDesktop() { this.Show(); this.BringToFront(); this.ShowIcon = true; notifyIcon.Visible = false; } private void notifyIcon_DoubleCl.. 2023. 7. 15.
View 에서 디자인 타임시 ViewMode Property 자동완성 연동 MainView.xaml xmlns:vm="clr-namespace:MVVM_Sample.ViewModels" d:DataContext="{d:DesignInstance Type={x:Type vm:MainViewModel}}" 2023. 6. 11.
Button click parameter (code behind) Tag 이용 "Button_Click" 함수에 "Click_Parameter" 문자열이 전달된다. Initiate private void Button_Click(object sender, RoutedEventArgs e) { var para = ((Button)sender).Tag; // Do something with para } 2023. 6. 1.
Xaml 특수문자 특수문자 Xaml Code 설명 \n Newline \t Tab & & Ampersand > Greater-than sign (Angle Bracket) " " Quotation mark ' ' Apostrophe " " Space 2023. 6. 1.
Upcasting using System; namespace Upcasting { internal class Program { static void Main(string[] args) { Child c = new Child(); Console.WriteLine($"[ Before Upcasting ]"); Console.WriteLine($"{c.GetType()}"); Console.WriteLine($"{c.Name}"); c.Do1(); c.Do2(); Console.WriteLine($""); Parent p = (Parent)c; Console.WriteLine($"[ After Upcasting ]"); Console.WriteLine($"{p.GetType()}"); Console.WriteLine($"{p... 2023. 5. 18.
가변 인수 매크로 #include "pch.h" #pragma warning(disable: 4793) // methods are compiled as native (clr warning) #include #include #include #include using namespace std; using namespace System; #define Log(fmt, ...) _log(__FILE__, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__) void _log(const char* filePath, const char* funcName, const int lineNum, const char* fmt, ...); void ShowQwerty(); void ShowNumber(); int ma.. 2023. 3. 30.
Time #include "pch.h" #include #include #include #include using namespace std; using namespace System; void ShowCurrentTime_Seconds(); void ShowCurrentTime(); void ShowElapsedTime(); int main() { ShowCurrentTime_Seconds(); ShowCurrentTime(); ShowElapsedTime(); std::string str; std::getline(std::cin, str); return 0; } void ShowCurrentTime_Seconds() { cout 2023. 3. 30.
Bit Shift #include "pch.h" #include #include #include using namespace std; using namespace System; int main() { // 0000010000000000 1024 // 0000001000000000 1024 >> 1 // 0000000000000001 1024 >> 10 // 0000000000000000 1024 >> 11 // 0000000000000010 1024 >> 10 2023. 3. 27.
키보드 보조키 상태 확인 Shift, Alt, Ctrl Keys key; /// Shift key = Keys.Shift; if ((Control.ModifierKeys & key) == key) { Console.WriteLine("Shift key pressed"); } /// Shift key = Keys.Alt; if ((Control.ModifierKeys & key) == key) { Console.WriteLine("Alt key pressed"); } /// Ctrl key = Keys.Control; if ((Control.ModifierKeys & key) == key) { Console.WriteLine("Ctrl key pressed"); } 2023. 1. 30.
시간 출력 #include #include #include using namespace std; time_t GetUnixTime() { time_t tt; tt = time(NULL); return tt; } int GetUnixTimeSecond() { return (int)GetUnixTime(); } string GetTimeString() { time_t tt = GetUnixTime(); struct tm t; localtime_s(&t, &tt); //char -> std::string.c_str() 변환 필요 char timeChars[200]; memset(timeChars, 0x00, 200); sprintf_s(timeChars, sizeof(timeChars), "%04d-%02d-%02d %.. 2022. 11. 5.
Insert Into Insert into Vendor values ('AAA', '2020-10-20 17:17:17.000', 200, 12000.5, 'Engine'); Insert into Vendor values ('AAA.C01', '2020-10-21 17:17:17.000', 12000, 24000.123, 'Engine'); Insert into Vendor values ('AAA.C02', '2020-08-22 17:17:17.000', 22000, 3200.1, 'Motor'); Insert into Vendor values ('AAA.D03', '2020-06-12 17:17:17.000', 32000, 65000.123, 'Motor'); Insert into Vendor values ('AAA.E04.. 2022. 11. 1.
검색 - 와일드 카드 select * from Vendor WHERE Name like '%._03' ORDER by sales 1. Name '.' 앞에는 문자열 와일드 카드 2. Name '.' 뒤에는 단일 문자 와일드 카드 3. Name 마지막 문자열이 '03' 4. Sales 기준으로 내림차순 정렬 2022. 11. 1.
검색 - 시간 간격 select * from Vendor where Timestamp between '2021-01-01 00:00:00.000' and '2021-12-31 23:59:59.999' order by Timestamp LIMIT 5 1. Timestamp 가 2021년내의 데이터만 조회 2. Timestamp 기준 정렬 3. 5개만 조회 2022. 11. 1.
Create Table create table if not exists Vendor ( Name TEXT NOT NULL UNIQUE, Timestamp TEXT NOT NULL, Employees INTEGER NOT NULL, Sales REAL NOT NULL, Type TEXT NOT NULL ); 'Vender' 테이블 생성 컬럼 이름 데이터 타입 속성 Name TEXT NOT NULL UNIQUE Timestamp TEXT NOT NULL Employees INTEGER NOT NULL Sales REAL NOT NULL Type TEXT NOT NULL 2022. 11. 1.
System.Windows.Data Error: 40 View(xaml) 컨트롤과 binding 된 변수가 ViewModel 에서 선언되지 않은 경우 발생 2022. 11. 1.
System.Windows.Data Error: 17 View(xaml) 컨트롤과 binding 된 변수가 할당되지 않는 경우 발생 1. Dialog ViewMode 생성자에서 아래와 같이 컬렉션을 생성 ObservableCollection Peoples = ObservableCollection(); 2. 다이얼로그 Open 시 컬렉션에 데이터를 할당하지만 Peoples = para.GetValue("PeopleInfoList"); 3. 다이얼로그 생성시 System.Windows.Data Error: 17 에러 발생 4. 위의 1번 과정에서 컬렉션에 기본 데이터 추가 후 에러 해결됨 ObservableCollection Peoples = ObservableCollection(); for (int i = 0; i < PeopleCount; i++) { Pe.. 2022. 11. 1.
CS0227 unsafe 옵션을 사용하여 컴파일 하는 경우 CS0227 오류 발생 프로젝트 - 속성 - 빌드 - "안전하지 않은 코드 허용" 체크 2022. 10. 23.
Close Window in ViewModel MVVM 패턴에서 ViewModel 이 Window 를 직접 접근하는 것은 권장하지 않는다. 방법 1. Application.Current.MainWindow.Close() 방법 2. ViewModel Code public class ViewModel { public Action CloseAction { get; set; } private void CloseCommandFunction() { CloseAction(); } } View Code(XAML) public partial class DialogWindow : Window { public DialogWindow() { ViewModel vm = new ViewModel(); this.DataContext = vm; vm.CloseAction = n.. 2022. 10. 23.