NGMsoftware

NGMsoftware
로그인 회원가입
  • 매뉴얼
  • 팁 앤 테크
  • 매뉴얼

    팁과 테크니컬 노하우를 확인하세요.

    팁 앤 테크

    팁과 테크니컬 노하우를 확인하세요.

    본 사이트의 컨텐츠는 저작권법의 보호를 받으므로 무단 복사, 게재, 배포 등을 금합니다.

    디자이너 텔레그램 원격제어 인터페이스 구현하기.

    페이지 정보

    본문

    안녕하세요. 엔지엠소프트웨어입니다.

    아래는 디자이너를 이용해서 텔레그램 원격제어의 인터페이스를 구현하는 방법입니다. 가장 단순한 뼈대만 구현되어 있으므로 필요하다면 기본 구조에서 기능을 추가할 수 있습니다. 예를 들어 원격제어의 상태를 관리한다거나 연결된 상태를 디자이너에 표시할수도 있습니다.

    1. 인터페이스 추가하기

    public partial class Form1 :NGM.GUI.ComponentDefault.MainView, NGM.Interface.IRemoteControl

     

     

    2. 속성 구현하기

            private TelegramBotClient _telegramBotClient;
    
            public TelegramBotClient TelegramConnection
            {
                get
                {
                    return _telegramBotClient;
                }
                set
                {
                    if (value == null)
                    {
                        if (_telegramBotClient != null)
                        {
                            _telegramBotClient.OnMessage -= RemoteHelper.Telegram_OnMessage;
                        }
    
                        RemoteHelper.RemoteControl = null;
                        _telegramBotClient = null;
                    }
                    else
                    {
                        _telegramBotClient = value;
                        RemoteHelper.RemoteControl = this;
                        _telegramBotClient.SendTextMessageAsync(ChatID, $"[{this.Text}] 텔레그램에 연결되었습니다.");
                        _telegramBotClient.OnMessage += RemoteHelper.Telegram_OnMessage;
                    }
                }
            }
    
            public PushbulletSharp.PushbulletClient PushBulletConnection { get; set; }
            public INGMRemoteControl NGMRemoteConnection { get; set; }
            public string ChatID { get; set; }

     

     

    3. 메소드 구현하기

            public void AllPlay()
            {
                // TODO
            }
    
            public void AllStop()
            {
                // TODO
            }
    
            public string Play(string fullName)
            {
                playButton1.PerformClick();
                return "실행되었습니다.";
            }
    
            public string Stop(string fullName)
            {
                stopButton1.PerformClick();
                return "중지되었습니다.";
            }

     

     

    추가로 필요한 내용이 있으면 댓글로 남겨주세요~

    에이프릴]새해 인사.gif > 걸그룹 | 퍼니포스트

    • 네이버 공유하기
    • 페이스북 공유하기
    • 트위터 공유하기
    • 카카오스토리 공유하기
    추천0 비추천0

    댓글목록

    등록된 댓글이 없습니다.