[Design Pattern] Singleton Pattern (싱글톤 패턴)
[Design Pattern] Singleton Pattern (싱글톤 패턴)
2013.12.26안녕하세요. 오늘 하루종일 싱글톤 패턴 알아보다 이렇게 포스팅 올리네요. 물론, 코드는 제가 한것도 있지만 외국 사이트에 있는 코드를 약간 응용해서 했고요. 싱글톤을 배울 때는 C++로만 사용하는 방법만 배웠고 Winform에서 할려니 좀 해맸어요..ㅎㅎ 머..배운지 벌써 2년이 넘어가서 그런것도 있지만.. 우선은 Winform 2개를 한개의 프로젝트안에서 생성을 합니다. 그냥 생성만 하시면 됩니다. public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { Form2.Instance.Show(); } } 메..
[C#] 엔터키 이벤트(KeyEvent)
[C#] 엔터키 이벤트(KeyEvent)
2013.11.22로그인을 하거나 값을 입력해서 확인 버튼을 누르는 경우가 많다. 하지만 습관이라는게 무서워서 그런지 나도 모르게 값을 입력을 하면 Enter Key를 누른다. 그래서 Enter Key Event 에 관해서 올려보자고 한다. private void Test_KeyDown(object sender, KeyEventArgs e){ if (e.KeyCode == Keys.Enter) { //to do } else { return; } } Text Box를 클릭을 하면 VS 2010 같은 경우 우측에서 번개 모양의 이벤트를 들어가서 메서드를 생성을 할 수 있다. KeyDown 이벤트를 더블 클릭하면 위에 코드처럼 메서드가 생성이 되면서 포커싱이 돌아간다. 작성을 완료하고 Text Box 에서 Enter Key를 ..
[C#] System.Security.SecurityException Window Serveice 등록시 Install Error
[C#] System.Security.SecurityException Window Serveice 등록시 Install Error
2013.07.23어쩌다 한번씩 윈도우 서비스를 만들어 처리해야할 경우가 있습니다.이럴때마다 서비스 등록시 아래와 같은 에러를 만나게 됩니다.워낙 드문 드문 하다보니 매번 잊어버리고 시간을 허비하게 하는 에러중 하나입니다. Service1 서비스를 설치하고 있습니다... EventLog 소스 Service1을(를) 로그 Application에 만들고 있습니다... 어셈블리 'C:\CrmService\CrmService\bin\Debug\CrmService.exe'을(를) 롤백하고 있습니다. 영향을 받는 매개 변수: logtoconsole = assemblypath = C:\CrmService\CrmService\bin\Debug\CrmService.exe i = logfile = C:\CrmService\CrmServic..
[C#] Console.Write & WriteLine 차이점
[C#] Console.Write & WriteLine 차이점
2013.05.31C# Console 프로그램을 하면 문자들을 출력하는 2개의 함수를 볼 수 있습니다. C# 콘솔에서 가장 많이 쓰이는 함수들이죠. Write 와 WriteLine 함수의 차이점을 간단히 이야기를 하면 Write와 WriteLine 함수는 괄호 안에 있는 문자열을 화면에 출력을 해 줍니다. 하지만 WriteLine은 문자열 뒤에 뉴라인(NewLine)문자를 추가합니다. Test Exampleusing System;using System.Collections.Generic;using System.Linq;using System.Text; namespace ConsoleApplication1{ class Program { static void Main(string[] args) { Console.Write("..