コード例 #1
0
        public LineServiceConfiguration()
        {
            BasicHttpBinding httpBinding = new BasicHttpBinding();

            LineServiceClient =
                new LineServiceClient(httpBinding, EndPoints.LineService);
        }
コード例 #2
0
        public BusSchedule(ClientCredentials clientCredentials)
        {
            InitializeComponent();

            LineService = new LineServiceClient();
            LineService.ClientCredentials.UserName.UserName = clientCredentials.UserName.UserName;
            LineService.ClientCredentials.UserName.Password = clientCredentials.UserName.Password;
        }
コード例 #3
0
ファイル: Presenter.cs プロジェクト: ajelesin/testsolution
        public async Task <SearchResult> FindLinesAsync(string substring, int pageNo, int pageSize)
        {
            if (string.IsNullOrWhiteSpace(substring))
            {
                return(Result.EmptySubstring());
            }

            using (var lineClient = new LineServiceClient())
            {
                var response = await lineClient.FindLinesAsync(substring, pageNo, pageSize);

                return(Result.LinesFound(response.Lines, response.PageSize, response.PageNo, response.PageAmount));
            }
        }
コード例 #4
0
ファイル: Presenter.cs プロジェクト: ajelesin/testsolution
        public async Task <Result> UploadFileAsync(FileInfo fileInfo,
                                                   CancellationToken token = new CancellationToken(), IProgress <double> reporter = null)
        {
            try
            {
                if (fileInfo == null || !fileInfo.Exists)
                {
                    return(Result.FileNotExists());
                }

                var      stopwatch = new Stopwatch();
                Response response;
                using (var lineClient = new LineServiceClient())
                    using (var stream = new FileStream(fileInfo.FullName, FileMode.Open, FileAccess.Read))
                        using (var progressedStream = new ProgressedStream(stream, token))
                        {
                            progressedStream.ProgressChanged += (sender, e) =>
                            {
                                reporter?.Report((e.Length == 0)
                            ? 0.0
                            : (double)e.BytesRead / (double)e.Length);
                            };

                            stopwatch.Start();
                            response = await lineClient.UploadFileAsync(fileInfo.FullName, fileInfo.Length, progressedStream);

                            stopwatch.Stop();
                        }

                return(response.Success
                    ? Result.FileUploaded(stopwatch.ElapsedMilliseconds)
                    : Result.FileNotUploaded());
            }
            catch (OperationCanceledException)
            {
                return(Result.Cancelled());
            }
            catch (Exception ex)
            {
                Logger.Fatal(ex.ToString);
                return(Result.Fail());
            }
        }
コード例 #5
0
        public BusScheduleDetails(ClientCredentials clientCredentials)
        {
            InitializeComponent();
            SelectedLine = new Line();
            BusStopService = new BusStopServiceClient();
            LineService = new LineServiceClient();
            LineSecureService = new LineSecureServiceClient();
            LineSecureService.ClientCredentials.UserName.UserName = clientCredentials.UserName.UserName;
            LineSecureService.ClientCredentials.UserName.Password = clientCredentials.UserName.Password;
            BusStopOnLineSecureService = new BusStopOnLineSecureServiceClient();
            BusStopOnLineSecureService.ClientCredentials.UserName.UserName = clientCredentials.UserName.UserName;
            BusStopOnLineSecureService.ClientCredentials.UserName.Password = clientCredentials.UserName.Password;

            FillListView(BusStopService.GetAll(),AllBusStops);

            DeleteButton.IsEnabled = false;
            EditButton.IsEnabled = false;

            SetEnabled();
            BlockListButtons();
            IsNewObjectEnable = true;
        }
コード例 #6
0
        public BusScheduleDetails(ClientCredentials clientCredentials, Line line)
        {
            InitializeComponent();

            BusStopService = new BusStopServiceClient();
            BusStopOnLineService = new BusStopOnLineServiceClient();
            LineService = new LineServiceClient();
            LineSecureService = new LineSecureServiceClient();
            LineSecureService.ClientCredentials.UserName.UserName = clientCredentials.UserName.UserName;
            LineSecureService.ClientCredentials.UserName.Password = clientCredentials.UserName.Password;
            BusStopOnLineSecureService = new BusStopOnLineSecureServiceClient();
            BusStopOnLineSecureService.ClientCredentials.UserName.UserName = clientCredentials.UserName.UserName;
            BusStopOnLineSecureService.ClientCredentials.UserName.Password = clientCredentials.UserName.Password;

            this.SelectedLine = line;
            SelectedBSOL = GetbyLineId(line.Id.Value, BusStopOnLineService.GetAll().Where(bsol=>bsol.Direction==true).ToArray());

            LineNumberTextBox.Text = line.Name;

            SelectedBusStopArray = ConvertToBusStop(SelectedBSOL);
            FillListView(BusStopService.GetAll(), AllBusStops);
            FillListView(SelectedBusStopArray, ActualBusStops);
            SetRelations();
            if(SelectedBSOL.First().Direction)
            {
                RelationTextBox.SelectedIndex = 0;
            }
            else
            {
                RelationTextBox.SelectedIndex = 1;
            }

            BlockButtons();

            SaveButton.IsEnabled = false;
            IsNewObjectEnable = false;
        }
コード例 #7
0
 public LineProvider()
 {
     _client = new LineServiceConfiguration().LineServiceClient;
 }