프로젝트

일반

사용자정보

개정판 a537d79a

IDa537d79a2ac438a5244d246d1fb2ece03738e9bf
상위 50f98ec3
하위 1caec1a9

김태성이(가) 5년 이상 전에 추가함

참조 수정/status 수정

Change-Id: Ic86b563e3ee53f3fd73a547379d15e432b1fb4e1

차이점 보기:

ConvertService/ServiceBase/Markus.Service.StationController/ViewModel/MainViewModel.cs
16 16

  
17 17
        public MainViewModel()
18 18
        {
19
            BasicHttpBinding myBinding = new BasicHttpBinding();
20
            EndpointAddress myEndpoint = new EndpointAddress(UriHelper.UriCreate("http://192.168.0.76:9101/StationService"));
21
            client = new StationService.StationServiceClient(myBinding, myEndpoint);
22
            client.AliveConvertListCompleted += Client_AliveConvertListCompleted;
19
            ServiceConnection();
23 20

  
24 21
            System.Windows.Threading.DispatcherTimer timer = new System.Windows.Threading.DispatcherTimer();
25 22
            timer.Interval = new TimeSpan(0, 0, 1);
......
37 34
            NavigationItems.First().IsSelected = true;
38 35
        }
39 36

  
37
        private void ServiceConnection()
38
        {
39
            try
40
            {
41
                if(client != null)
42
                {
43
                    client.Abort();
44
                    client.AliveConvertListCompleted -= Client_AliveConvertListCompleted;
45
                    client = null;
46
                }
47

  
48
                var configFileName = $"StationController.ini";
49

  
50
                var config = ConfigHelper.AppConfig(configFileName);
51

  
52
                var serviceUri = config.GetValue("SERVICE", "ADDRESS", "http://LOCALHOST:9101/StationService");
53

  
54
                BasicHttpBinding myBinding = new BasicHttpBinding();
55
                EndpointAddress myEndpoint = new EndpointAddress(UriHelper.UriCreate(serviceUri));
56
                client = new StationService.StationServiceClient(myBinding, myEndpoint);
57
                client.AliveConvertListCompleted += Client_AliveConvertListCompleted;
58
            }
59
            catch (Exception)
60
            {
61
            }
62

  
63
        }
64

  
40 65
        private void Timer_Tick(object sender, EventArgs e)
41 66
        {
42
            client.AliveConvertListAsync();
67
            try
68
            {
69
                client.AliveConvertListAsync();
70
            }
71
            catch (Exception ex)
72
            {
73
                ServiceConnection();
74
            }
43 75
        }
44 76

  
45 77
        private void Client_AliveConvertListCompleted(object sender, AliveConvertListCompletedEventArgs e)

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)