[WPF] Command 사용하기
·
c#/WPF
ModelView에 클릭 기능(Button)을 만들기 - CanExecute: command 활성화, 비활성화 가능 - Execute: Command가 호출 됐을 때 실행 1. ICommand 를 상속받는 클래스 생성 2. ViewModel 에 객체 생성 3. XAML 에 Button에서 Click 삭제 후, Command 태그 1.RelayCommand.cs 파일 만들기 2. ViewModel에 RelayCommand 객체 생성 3.ViewModel에 RelayCommand 에 전달할 CanExecute, Execute 파라미터 메서드 생성 4. xaml 에 CommandParameter을 이용하여 바인딩
[WPF] MVVM 패턴 적용해보기 (기초, 초급, 쉬움)
·
c#/WPF
ViewModels 폴더 생성 -> MainViewModel.cs 생성하기 - INotifyPropertychanged 를 상속받아야 함 : 값이 변경되면 전달하기 위해 - progressValue 값이 변한 것을 View에 나타낼것임 - INotifyPropertychanged 인터페이스 구현해주기 public event PropertyChangedEventHandler PropertyChanged; // This method is called by the Set accessor of each property. // The CallerMemberName attribute that is applied to the optional propertyName // parameter causes the prope..
[WPF] Style 사용하기
·
c#/WPF
Label의 BackGround만 반투명(30%)로 만들어 주기 VerticalAlignment , HorizontalAlignment Style Tag StaticResource 여러 군데 적용하기 Style.Triggers - DataTrigger: - INotifyPropertyChanged: INotifyPropertyChanged는 바인딩이 업데이트되도록 뷰(화면)에게 알려줍니다.
[wpf] (인프런) WPF(c#) 강의 WPF의 사용 이유/대표적인 컨트롤러
·
c#/WPF
WPF의 사용 이유 뛰어난 UI를 쉽게 개발 MVVM패턴을 사용한 정해진 구조 사용 대표적인 컨트롤러 RadioButton: Group으로 묶어주면 하나만 선택 가능 propfull +tap+ tap = ListView - user Class 생성 Image 1. 하드 코딩 2. 데이터 바인딩
[c#] 문자열이 숫자인지 확인 & 문자열 자르기
·
c#
Task: Key가 숫자로 구성되어있다면: Key 비교할 때, 뒤에서부터 9자리까지만 비교해서 똑같으면 출력 디바이스의 Key가 숫자로만 구성되어있지 않다면, 키 전체를 비교해서 똑같으면 출력 1. 문자열이 숫자인지 확인 if (logFileNameArr[1].All(char.IsDigit)) //인덱스 [1]인 부분이 숫자로만 구성되어있다면, 뒷 9자리만 불러서 키 값과 일치하는지 검사 { string logFileNameString = logFileNameArr[1]; string tempString = logFileNameString.Substring(logFileNameString.Length-9); if (key.Equals(tempString)) { Console.WriteLine("숫자로만 ..
[c#] ftp에서 불러온 파일을 저장할 때, 같은 이름의 파일이 있을 경우 넘버링(숫자) 해주기
·
c#
//저장할 파일이름을 이미 포함하고 있다면 넘버링 foreach (FileInfo File in di.GetFiles()) { String FullFileName = File.FullName; if (FullFileName.Contains(logName + "(" + fileCount + ")")) { fileCount++; } } saveFileDialog.InitialDirectory = filePath; saveFileDialog.Title = "저장 경로를 지정하세요."; saveFileDialog.FileName = logName + "(" + fileCount + ")"; fileCount = 0; FileInfo File in di.GetFiles() foreach문으로 현재 디렉토리의 모든..
[c#] FTP에서 매개변수 "logName"을 파일 명으로 가진 파일을 다운로드하는 창 띄우기
·
c#
public void OpenLogDownloadWindow(string logName) { try { //TODO 최희연 : FTP에서 매개변수 logName을 파일 명으로 가진 파일을 다운로드 창을 띄움 string fileName = string.Empty; //ftp에서 디렉토리 목록 전체 조회한 데이터 string[] filesInDirectory = LoadFTPData( newUrl + logName, id, pwd, download); string data1 = string.Empty; for (int i = 0; i < filesInDirectory.Length; i++) { data1 += filesInDirectory[i]; } SaveFileDialog saveFileDialog =..
[c#] FTP에서 디렉토리(Directory)와 파일(File) 불러오기
·
c#
💡 디렉토리와 파일을 구분하는 방법? 불러온 주소를 다시 덧붙여서 하위 디렉토리가 있는지 검사 → 하위 파일이나 디렉토리가 없는 경우, 검사하기 어려움 파일 접근 권한에 ‘d’가 붙은 지 검사 using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; namespace loadingFtp { internal class Class1 { public static void Main(String[] args) { Uri ftpUri = ..
Boxing/UnBoxing
·
c#
Boxing/UnBoxing 1. 특징 박싱(Boxing) : 값 형식(Value types)→참조 형식(reference types) 언박싱(UnBoxing) : 박싱했던 값을 원상복귀 2. 사용 이유 ex) 배열 object[] array = new object[2]; 배열에 다양한 타입을 넣을 수 있음 3. 장단점 단점 박싱 시, 스택에 있는 값을 복사하여 힙에 할당/ 언박싱 시, 다시 스택에 반환 → 가비지 ++ → 메모리 비효율 많은 시간 소요 4. 예시 박싱(Boxing) int i=5; object o=i; 언박싱(UnBoxing)
[백준 15652번 c#] N과 M (4)
·
c#/백준알고리즘
using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Project2 { class Class1 { static StringBuilder sb = new StringBuilder(); static int[] arr; static int N, M; static void Main(string[] args) { StreamWriter writer = new StreamWriter(Console.OpenStandardOutput()); StreamReader read..