C# 관리자 권한으로 실행 설정


1. [프로젝트 속성창]-[보안]-[ClickOnce 보안 설정 사용]

    체크를 하면 app.manifest 파일 생성됨

2. 파일 생성 확인 후 [ClickOnce 보안 설정 사용] 체크 해제

3. app.manifest 파일을 열기

4.  app.manifest 파일 내용 중 
    <requestedExecutionLevel level=" asInvoker" uiAccess="false" /> 구문을
    <requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> 로 수정함

'프로그래밍 > C#' 카테고리의 다른 글

[C#] 인터넷 연결 유무 확인  (0) 2012.03.28
[C#] Percent Encoding  (0) 2012.03.28
[C#] Convert String to System.Windows.Forms.Shortcut  (0) 2012.03.23
Posted by 암리타 :
    class Internet
    {
        //Creating the extern function...
        [DllImport("wininet.dll")]
        private extern static bool InternetGetConnectedState( out int Description, 
                  int ReservedValue ) ;

        /// <summary>
        /// 인터넷 연결 체크
        /// </summary>
        /// <returns>인터넷 연결이 안된 경우 false</returns>
        public static bool IsConnectedToInternet( )
        {
            int Desc ;
            return InternetGetConnectedState( out Desc, 0 ) ;
        }
    }

'프로그래밍 > C#' 카테고리의 다른 글

[C#] 관리자 권한으로 실행 설정  (1) 2012.04.02
[C#] Percent Encoding  (0) 2012.03.28
[C#] Convert String to System.Windows.Forms.Shortcut  (0) 2012.03.23
Posted by 암리타 :

[C#] Percent Encoding

2012. 3. 28. 10:16 from 프로그래밍/C#

참고 Url : http://en.wikipedia.org/wiki/Percent-encoding


Posted by 암리타 :
            string key = ConfigFile.Instance.key1  + "+" + ConfigFile.Instance.key2;

            KeysConverter conv = new KeysConverter();
            Keys keys = (Keys)conv.ConvertFromString(key);
            hotkey.Shortcut = (System.Windows.Forms.Shortcut)keys;

'프로그래밍 > C#' 카테고리의 다른 글

[C#] 관리자 권한으로 실행 설정  (1) 2012.04.02
[C#] 인터넷 연결 유무 확인  (0) 2012.03.28
[C#] Percent Encoding  (0) 2012.03.28
Posted by 암리타 :
Canvas에서 Matrix를 이용하여 화면의 회전, 이동, 스케일 조정이 가능하다.
Posted by 암리타 :

public CountDownTimer (long millisInFuture, long countDownInterval)
millisInFuture : 카운트 할 시간
countDownInterval : interval후에 onTick 호출

CountDownTimer 시작 : timer.start();
CountDownTimer 종료 : timer.cancel();

아래 예제는 1초 간격으로  6초동안 진행된다.
public CountDownTimer timer = new CountDownTimer(6000, 1000) {

	@Override
	public void onFinish() {
		//TODO : 카운트다운타이머 종료시 처리
	}

	@Override
	public void onTick(long millisUntilFinished) {
		//TODO : 카운트다운타이머 onTick구현
	}
};


Posted by 암리타 :
// 안드로이드 네트워크 연결상태 확인 (Mobile/Wifi) 
ConnectivityManager manager = 
	(ConnectivityManager) getSystemService (Context.CONNECTIVITY_SERVICE);

// 3G(모바일 네트워크) 연결 상태 
boolean isMobile = 
	manager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).isConnectedOrConnecting();

// Wifi 네트워크 연결 상태 
boolean isWifi = 
	manager.getNetworkInfo(ConnectivityManager.TYPE_WIFI).isConnectedOrConnecting
Posted by 암리타 :
안드로이드의 raw, asset 폴더의 개별 파일의 크기가 1MB 이상인 경우 Data exceeds UNCOMPRESS_DATA_MAX 에러가 발생한다.
해당 파일의 확장자를 변경하여 해결할수 있다.

Data exceeds UNCOMPRESS_DATA_MAX
It seems that android has put a limit of 1 MB on the size of the files that yo can put in your asset folder, which can be accessed through the Context. The reason for this is the "aapt" tool that Android uses to compress files into your apk install file. 

Eclipse doesn't not allow one to set complier options such as "aapt -0". One would have to edit the Ant file that Android uses or manually build the apk package from scratch which is the work that Ant would do.

I tried copying my 1.5 MB file to a raw folder but that didn't seem to work. Ultimately I used one of the following file extensions which are not compressed by default by the "aapt" command. These are:

/* these formats are already compressed, or don't compress well */
static const char* kNoCompressExt[] = {
".jpg", ".jpeg", ".png", ".gif",
".wav", ".mp2", ".mp3", ".ogg", ".aac",
".mpg", ".mpeg", ".mid", ".midi", ".smf", ".jet",
".rtttl", ".imy", ".xmf", ".mp4", ".m4a",
".m4v", ".3gp", ".3gpp", ".3g2", ".3gpp2",
".amr", ".awb", ".wma", ".wmv"
};

My application is now working fine with the large_file.jet extension from the assets folder.
출처 : http://www.nutprof.com/2010/12/data-exceeds-uncompressdatamax.html
Posted by 암리타 :
public TimerTask myTimer = new TimerTask() {
	public void run() {
		Log.d("neo", "run timer");
	}
};

timer = new Timer();
timer.schedule(myTimer, 500, 1000);


public void schedule (TimerTask task, long delay, long period)

timer.schedule 설명
TimerTask : 작업할 내용
delay : 몇 ms 후에 호출할 것인지
period : 몇 ms 간격으로 호출한것인지

[원문]
task the task to schedule.
delay amount of time in milliseconds before first execution.
period amount of time in milliseconds between subsequent executions.
Posted by 암리타 :

이클립스에서 에뮬레이터로 데이터 전송시 java.io.IOException: Unable to upload file: null 오류가 발생할 경우는 apk 파일의 크기가 커서 파일 전송시 문제가 발생한 경우이다.
이클립스 메뉴의 Window -> Preferences -> Android -> DDMS -> "ADB connection time out (ms) 값을 크게 잡으면 문제가 해결된다.
Posted by 암리타 :