private void LoadMenu() { MenuList.Add(new MenuItem() { Icon = "\uf0e4", Title = "Dashboard", PageName = MasterModule.GetMasterNavigationPage(PageRoutes.GetKey <DashBoardPage>()) }); MenuList.Add(new MenuItem() { Icon = "\uf073", Title = "Timesheet", PageName = MasterModule.GetMasterNavigationPage(PageRoutes.GetKey <TimesheetPage>()) }); MenuList.Add(new MenuItem() { Icon = "\uf06e", Title = "Review", PageName = MasterModule.GetMasterNavigationPage(PageRoutes.GetKey <ReviewPage>()) }); MenuList.Add(new MenuItem() { Icon = "\uf085", Title = "Configuration", PageName = MasterModule.GetMasterNavigationPage(PageRoutes.GetKey <ConfigurationPage>()) }); }
protected void GoBack() { var navigationParameters = new NavigationParameters(); navigationParameters.Add(Imputed.Tag, Context); BaseModule.NavigationService.NavigateAsync($"../{PageRoutes.GetKey<AddActivityPage>()}", navigationParameters, false, false); }
protected async void Next() { var navigationParameters = new NavigationParameters(); navigationParameters.Add(Imputed.Tag, Context); await BaseModule.NavigationService.NavigateAsync(PageRoutes.GetKey <AddActivityTimeDesviationPage>(), navigationParameters, false, false); }
public void TestDateIsSmallerThenToday() //try to vuy ticket on yesterday train { DateTime date1 = DateTime.Now; date1 = date1.AddDays(-5); string someday = date1.ToShortDateString(); bool expected = false; PageHome pageHome = new PageHome(); PageFactory.InitElements(driver, pageHome); pageHome.RoutesPageButton.Click(); PageRoutes pageRoutes = new PageRoutes(); PageFactory.InitElements(driver, pageRoutes); pageRoutes.DepartureStationField.Clear(); pageRoutes.DepartureDateField.Clear(); pageRoutes.ArrivalStationField.Clear(); pageRoutes.DepartureStationField.SendKeys("Минск"); pageRoutes.ArrivalStationField.SendKeys("Гомель"); pageRoutes.DepartureDateField.Clear(); pageRoutes.DepartureDateField.SendKeys(someday); pageRoutes.ContinueButton.Click(); bool result = pageRoutes.TrainTab.Selected; Assert.AreEqual(result, expected); }
protected async void ManageImputedDay() { if (this.IsInternetAndCloseModal()) { try { var selectedDateTimesheet = _timesheetModule.TimesheetService.GetTimesheetByDate(_currentTimesheet, Dates.FirstOrDefault()); if (selectedDateTimesheet.Day != null) { var navigationParameters = new NavigationParameters(); navigationParameters.Add(TimesheetForDay.Tag, selectedDateTimesheet); await BaseModule.NavigationService.NavigateAsync(PageRoutes.GetKey <ManageImputedDayPage>(), navigationParameters); BaseModule.AnalyticsService.TrackEvent("[Activity] :: Info :: Timesheet"); } else { throw new ArgumentNullException(); } } catch (Exception) { BaseModule.DialogService.ShowToast("The all days selected is closed or failed load the month. The month will be load again"); ChangeDateCalendar(_currentDayMonthYear); } } }
protected void OnInfoActivityItem(ActivityDay from) { var navigationParameters = new NavigationParameters(); navigationParameters.Add(ActivityDay.Tag, from); BaseModule.NavigationService.NavigateAsync(PageRoutes.GetKey <InfoActivityPopUpPage>(), navigationParameters, true, true); }
private async void SignIn() { try { IsBusy = true; if (Validate()) { var responseRequest = await BaseModule.AuthenticationService.Login(_email.Value, _password.Value); if (responseRequest.Success) { NavigateCommand.Execute(MasterModule.GetMasterNavigationPage(PageRoutes.GetKey <DashBoardPage>())); } else { IsBusy = false; await BaseModule.DialogService.ShowAlertAsync(responseRequest.Message, "Login error", "Ok"); } } } catch (ServiceAuthenticationException) { await BaseModule.DialogService.ShowAlertAsync("Please, try again", "Login error", "Ok"); } catch (Exception) { await BaseModule.DialogService.ShowAlertAsync("An error occurred, try again", "Error", "Ok"); } finally { IsBusy = false; } }
protected async void ManageMultipleImputedDay() { if (this.IsInternetAndCloseModal()) { try { var selectedDateTimesheet = _timesheetModule.TimesheetService.GetTimesheetByDates(_currentTimesheet, Dates.ToList()); if (selectedDateTimesheet.Days.Any()) { var imputed = new Imputed() { CurrentTimesheetMultipleDay = selectedDateTimesheet }; var navigationParameters = new NavigationParameters(); navigationParameters.Add(Imputed.Tag, imputed); await BaseModule.NavigationService.NavigateAsync(PageRoutes.GetKey <AddActivityPage>(), navigationParameters); BaseModule.AnalyticsService.TrackEvent("[Activity] :: Add :: Multilple :: Timesheet"); } else { throw new ArgumentNullException(); } } catch (Exception) { BaseModule.DialogService.ShowToast("The all days selected is closed or failed load the month. The month will be load again"); ChangeDateCalendar(_currentDayMonthYear); } } }
protected void Close() { if (IsInternetAndCloseModal()) { NavigateCommand.Execute(MasterModule.GetMasterNavigationPage(PageRoutes.GetKey <DashBoardPage>())); } }
protected async void ManageImputedDay(ReviewTimeLine from) { if (this.IsInternetAndCloseModal()) { try { var selectedDateTimesheet = TimeLineList.FirstOrDefault(x => x.Day == from.Day); if (selectedDateTimesheet.Day != null) { var navigationParameters = new NavigationParameters(); var timesheetForDay = new TimesheetForDay() { Day = selectedDateTimesheet.Day, Activities = selectedDateTimesheet.Activities, Projects = _currentReview?.Projects?.Values?.ToList() }; navigationParameters.Add(TimesheetForDay.Tag, timesheetForDay); navigationParameters.Add("IsVisibleButtonAdd", false); await BaseModule.NavigationService.NavigateAsync(PageRoutes.GetKey <ManageImputedDayPage>(), navigationParameters); } else { throw new ArgumentNullException(); } } catch (Exception) { BaseModule.DialogService.ShowToast("Fail load Detail. Try Again."); } } }
public void TestRouteHaveNotTime() { DateTime date1 = DateTime.Now; string today = date1.ToShortDateString(); bool expected = false; PageHome pageHome = new PageHome(); PageFactory.InitElements(driver, pageHome); pageHome.RoutesPageButton.Click(); PageRoutes pageRoutes = new PageRoutes(); PageFactory.InitElements(driver, pageRoutes); pageRoutes.DepartureStationField.Clear(); pageRoutes.DepartureDateField.Clear(); pageRoutes.ArrivalStationField.Clear(); pageRoutes.DepartureStationField.SendKeys("Минск"); pageRoutes.ArrivalStationField.SendKeys("Жлобин"); pageRoutes.DepartureDateField.Clear(); pageRoutes.DepartureDateField.SendKeys(today); pageRoutes.TimeBoxesResetTimeButton.Click(); pageRoutes.ContinueButton.Click(); bool result = pageRoutes.TrainTab.Selected; Assert.AreEqual(result, expected); }
public void TestDateIsMoreThen45DaysFromToday() { DateTime date1 = DateTime.Now; date1 = date1.AddDays(61); // railway station son't seal tickets on date more then 60 days from today string someday = date1.ToShortDateString(); bool expected = false; PageHome pageHome = new PageHome(); PageFactory.InitElements(driver, pageHome); pageHome.RoutesPageButton.Click(); PageRoutes pageRoutes = new PageRoutes(); PageFactory.InitElements(driver, pageRoutes); pageRoutes.DepartureStationField.Clear(); pageRoutes.DepartureDateField.Clear(); pageRoutes.ArrivalStationField.Clear(); pageRoutes.DepartureStationField.SendKeys("Минск"); pageRoutes.ArrivalStationField.SendKeys("Гомель"); pageRoutes.DepartureDateField.Clear(); pageRoutes.DepartureDateField.SendKeys(someday); pageRoutes.ContinueButton.Click(); bool result = pageRoutes.TrainTab.Selected; Assert.AreEqual(result, expected); }
protected async void ManageImputedDay() { var selectedDateTimesheet = _timesheetModule.TimesheetService.GetTimesheetByDate(_currentTimesheet, Dates.FirstOrDefault()); var navigationParameters = new NavigationParameters(); navigationParameters.Add(TimesheetForDay.Tag, selectedDateTimesheet); await BaseModule.NavigationService.NavigateAsync(PageRoutes.GetKey <ManageImputedDayPage>(), navigationParameters); }
protected override async void OnInitialized() { BlobCache.ApplicationName = AppSettings.IdAppCache; InitializeComponent(); await NavigationService.NavigateAsync(PageRoutes.GetKey <SplashPage>()); }
protected override async void OnInitialized() { InitializeComponent(); TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException; BlobCache.ApplicationName = AppSettings.IdAppCache; await NavigationService.NavigateAsync(PageRoutes.GetKey <SplashPage>()); }
protected override void RegisterTypes(IContainerRegistry containerRegistry) { containerRegistry.RegisterForNavigation <SplashPage>(); containerRegistry.RegisterForNavigation <LoginPage>(); PageRoutes.AddKey <SplashPage>($"/{nameof(SplashPage)}"); PageRoutes.AddKey <LoginPage>($"/{nameof(LoginPage)}"); }
protected async void Next() { if (IsInternetAndCloseModal()) { var navigationParameters = new NavigationParameters(); navigationParameters.Add(Imputed.Tag, Context); await BaseModule.NavigationService.NavigateAsync(PageRoutes.GetKey <AddActivityProjectPage>(), navigationParameters, false, false); } }
protected override void RegisterTypes(IContainerRegistry containerRegistry) { //# Container Services //ServicesLoader.Load(containerRegistry); //# Container Components containerRegistry.RegisterForNavigation <HelloPage>(); PageRoutes.AddKey <HelloPage>($"/{nameof(HelloPage)}"); }
private void AuthenticationRun() { if (AppSettings.AuthenticatedUserResponse != null) { BaseModule.NavigationService.NavigateAsync(MasterModule.GetMasterNavigationPage(AppSettings.StartupView)); } else { NavigateCommand.Execute(PageRoutes.GetKey <LoginPage>()); } }
protected override async void OnInitialized() { try { InitializeComponent(); await NavigationService.NavigateAsync(PageRoutes.GetKey <HelloPage>()); } catch (Exception e) { } }
protected async void OnAddItem() { var navigationParameters = new NavigationParameters(); var imputedContext = new Imputed() { CurrentTimesheet = _currentTimesheetForDay }; navigationParameters.Add(Imputed.Tag, imputedContext); await BaseModule.NavigationService.NavigateAsync(PageRoutes.GetKey <AddActivityPage>(), navigationParameters, false, true); }
async void TaskScheduler_OnConnectivityChanged(object sender, Plugin.Connectivity.Abstractions.ConnectivityChangedEventArgs e) { if (e.IsConnected == true) { AuthenticationRun(true); } else { await NavigationService.NavigateAsync(PageRoutes.GetKey <ConnectionPage>()); } }
public AdminRoutes() { Page = new PageRoutes(Url); Folder = new FolderRoutes(Url); Widget = new WidgetRoutes(Url); Search = new SearchRoutes(Url, "Page"); Template = new TemplateRoutes(Url); TemplateSearch = new SearchRoutes(Url, "Template"); Facebook = new FacebookRoutes(Url, "Page"); TemplateFacebook = new FacebookRoutes(Url, "Template"); MediaFolder = new MediaFolderRoutes(Url); }
protected async void OnAddItem() { var navigationParameters = new NavigationParameters(); var imputedContext = new Imputed() { CurrentTimesheet = _currentTimesheetForDay }; navigationParameters.Add(Imputed.Tag, imputedContext); await BaseModule.NavigationService.NavigateAsync(PageRoutes.GetKey <AddActivityPage>(), navigationParameters, false, true); BaseModule.AnalyticsService.TrackEvent("[Activity] :: Add :: Single :: ManageImputedDay"); }
public void TestRoutePageOpen() { bool result = false; bool expected = true; PageHome pageHome = new PageHome(); PageFactory.InitElements(driver, pageHome); pageHome.RoutesPageButton.Click(); PageRoutes pageRoutes = new PageRoutes(); PageFactory.InitElements(driver, pageRoutes); result = pageRoutes.ContinueButton.Displayed; Assert.AreEqual(expected, result); }
public void TestRouteDateSetClickable() { PageHome pageHome = new PageHome(); PageFactory.InitElements(driver, pageHome); pageHome.RoutesPageButton.Click(); PageRoutes pageRoutes = new PageRoutes(); PageFactory.InitElements(driver, pageRoutes); pageRoutes.DepartureStationField.Clear(); pageRoutes.DepartureDateField.Clear(); pageRoutes.ArrivalStationField.Clear(); pageRoutes.TimeBoxesResetTimeButton.Click(); pageRoutes.TimeBox(1).Click(); pageRoutes.TimeBox(7).Click(); }
async Task AuthenticationRun(bool forceRefresh = false) { try { var result = await _authenticationService.UserIsAuthenticatedAndValidAsync(forceRefresh); if (!result) { await NavigationService.NavigateAsync(PageRoutes.GetKey <LoginPage>()); } } catch (Exception ex) { Debug.WriteLine(ex); } }
public PanelNewRoute(PageRoutes parent) { this.Classes = new Dictionary <AirlinerClass.ClassType, RouteAirlinerClass>(); this.CargoPrice = 10; var query = from a in AirlinerTypes.GetTypes(delegate(AirlinerType t) { return(t.Produced.From < GameObject.GetInstance().GameTime); }) select a.Range; this.MaxDistance = query.Max(); this.ParentPage = parent; this.Margin = new Thickness(0, 0, 50, 0); TextBlock txtHeader = new TextBlock(); txtHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; txtHeader.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush2"); txtHeader.FontWeight = FontWeights.Bold; txtHeader.Text = Translator.GetInstance().GetString("PanelNewRoute", "201"); this.Children.Add(txtHeader); WrapPanel panelRouteType = new WrapPanel(); rbPassenger = new RadioButton(); rbPassenger.GroupName = "RouteType"; rbPassenger.Content = Translator.GetInstance().GetString("PanelNewRoute", "1005"); rbPassenger.Checked += rbRouteType_Checked; rbPassenger.Tag = Route.RouteType.Passenger; panelRouteType.Children.Add(rbPassenger); rbCargo = new RadioButton(); rbCargo.Margin = new Thickness(10, 0, 0, 0); rbCargo.GroupName = "RouteType"; rbCargo.Content = Translator.GetInstance().GetString("PanelNewRoute", "1006"); rbCargo.Tag = Route.RouteType.Cargo; //rbCargo.IsEnabled = false; rbCargo.Checked += rbRouteType_Checked; panelRouteType.Children.Add(rbCargo); this.Children.Add(panelRouteType); panelRouteInfo = new StackPanel(); this.Children.Add(panelRouteInfo); //rbPassenger.IsChecked = true; }
public PanelNewRoute(PageRoutes parent) { this.Classes = new Dictionary<AirlinerClass.ClassType, RouteAirlinerClass>(); this.CargoPrice = 10; var query = from a in AirlinerTypes.GetTypes(delegate(AirlinerType t) { return t.Produced.From < GameObject.GetInstance().GameTime; }) select a.Range; this.MaxDistance = query.Max(); this.ParentPage = parent; this.Margin = new Thickness(0, 0, 50, 0); TextBlock txtHeader = new TextBlock(); txtHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; txtHeader.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush2"); txtHeader.FontWeight = FontWeights.Bold; txtHeader.Text = Translator.GetInstance().GetString("PanelNewRoute", "201"); this.Children.Add(txtHeader); WrapPanel panelRouteType = new WrapPanel(); rbPassenger = new RadioButton(); rbPassenger.GroupName = "RouteType"; rbPassenger.Content = Translator.GetInstance().GetString("PanelNewRoute", "1005"); rbPassenger.Checked += rbRouteType_Checked; rbPassenger.Tag = Route.RouteType.Passenger; panelRouteType.Children.Add(rbPassenger); rbCargo = new RadioButton(); rbCargo.Margin = new Thickness(10, 0, 0, 0); rbCargo.GroupName = "RouteType"; rbCargo.Content = Translator.GetInstance().GetString("PanelNewRoute", "1006"); rbCargo.Tag = Route.RouteType.Cargo; //rbCargo.IsEnabled = false; rbCargo.Checked += rbRouteType_Checked; panelRouteType.Children.Add(rbCargo); this.Children.Add(panelRouteType); panelRouteInfo = new StackPanel(); this.Children.Add(panelRouteInfo); //rbPassenger.IsChecked = true; }
public void TestRouteAllFieldisEmpty() { bool expected = false; PageHome pageHome = new PageHome(); PageFactory.InitElements(driver, pageHome); pageHome.RoutesPageButton.Click(); PageRoutes pageRoutes = new PageRoutes(); PageFactory.InitElements(driver, pageRoutes); pageRoutes.DepartureStationField.Clear(); pageRoutes.DepartureDateField.Clear(); pageRoutes.ArrivalStationField.Clear(); pageRoutes.ContinueButton.Click(); bool result = pageRoutes.TrainTab.Selected; Assert.AreEqual(result, expected); }
private async void AuthenticationRun() { if (CrossConnectivity.Current.IsConnected) { if (await BaseModule.AuthenticationService.UserIsAuthenticatedAndValidAsync()) { NavigateCommand.Execute(MasterModule.GetMasterNavigationPage(PageRoutes.GetKey <DashBoardPage>())); } else { NavigateCommand.Execute(PageRoutes.GetKey <LoginPage>()); } } else { NavigateCommand.Execute(PageRoutes.GetKey <ConnectionPage>()); } }
public PanelRoute(PageRoutes parent, Route route) { this.Classes = new Dictionary<Route, Dictionary<AirlinerClass.ClassType, RouteAirlinerClass>>(); this.ParentPage = parent; this.Route = route; this.Margin = new Thickness(0, 0, 50, 0); TextBlock txtHeader = new TextBlock(); txtHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; txtHeader.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush2"); txtHeader.FontWeight = FontWeights.Bold; txtHeader.Uid = "1000"; txtHeader.Text = Translator.GetInstance().GetString("PanelRoute", txtHeader.Uid); this.Children.Add(txtHeader); ListBox lbRouteInfo = new ListBox(); lbRouteInfo.ItemContainerStyleSelector = new ListBoxItemStyleSelector(); lbRouteInfo.SetResourceReference(ListBox.ItemTemplateProperty, "QuickInfoItem"); this.Children.Add(lbRouteInfo); double distance = MathHelpers.GetDistance(this.Route.Destination1.Profile.Coordinates, this.Route.Destination2.Profile.Coordinates); lbRouteInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelRoute","1016"),UICreator.CreateTextBlock(this.Route.Type.ToString()))); lbRouteInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelRoute","1001"), UICreator.CreateTextBlock(this.Route.Destination1.Profile.Name))); lbRouteInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelRoute","1002"), UICreator.CreateTextBlock(this.Route.Destination2.Profile.Name))); if (this.Route.HasStopovers) lbRouteInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelRoute", "1003"), UICreator.CreateTextBlock(string.Join(", ", from s in this.Route.Stopovers select new AirportCodeConverter().Convert(s.Stopover).ToString())))); lbRouteInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelRoute", "1004"), UICreator.CreateTextBlock(string.Format("{0:0} {1}", new NumberToUnitConverter().Convert(distance), new StringToLanguageConverter().Convert("km."))))); if (this.Route.Type == Route.RouteType.Passenger || this.Route.Type == Route.RouteType.Mixed) { this.Classes.Add(route, new Dictionary<AirlinerClass.ClassType, RouteAirlinerClass>()); foreach (AirlinerClass.ClassType type in Enum.GetValues(typeof(AirlinerClass.ClassType))) { RouteAirlinerClass rClass = ((PassengerRoute)this.Route).getRouteAirlinerClass(type); this.Classes[route].Add(type, rClass); WrapPanel panelClassButtons = new WrapPanel(); Button btnEdit = new Button(); btnEdit.Background = Brushes.Transparent; btnEdit.Tag = new KeyValuePair<Route, AirlinerClass.ClassType>(this.Route, type); btnEdit.Click += new RoutedEventHandler(btnEdit_Click); Image imgEdit = new Image(); imgEdit.Width = 16; imgEdit.Source = new BitmapImage(new Uri(@"/Data/images/edit.png", UriKind.RelativeOrAbsolute)); RenderOptions.SetBitmapScalingMode(imgEdit, BitmapScalingMode.HighQuality); btnEdit.Content = imgEdit; Boolean inRoute = route.getAirliners().Exists(a => a.Status != FleetAirliner.AirlinerStatus.Stopped); //btnEdit.Visibility = this.Route.HasAirliner && (this.Route.getCurrentAirliner() != null && this.Route.getCurrentAirliner().Status != FleetAirliner.AirlinerStatus.Stopped) ? Visibility.Collapsed : System.Windows.Visibility.Visible; btnEdit.Visibility = inRoute ? Visibility.Collapsed : System.Windows.Visibility.Visible; panelClassButtons.Children.Add(btnEdit); Image imgInfo = new Image(); imgInfo.Width = 16; imgInfo.Source = new BitmapImage(new Uri(@"/Data/images/info.png", UriKind.RelativeOrAbsolute)); imgInfo.Margin = new Thickness(5, 0, 0, 0); imgInfo.VerticalAlignment = System.Windows.VerticalAlignment.Bottom; RenderOptions.SetBitmapScalingMode(imgInfo, BitmapScalingMode.HighQuality); Border brdToolTip = new Border(); brdToolTip.Margin = new Thickness(-4, 0, -4, -3); brdToolTip.Padding = new Thickness(5); brdToolTip.SetResourceReference(Border.BackgroundProperty, "HeaderBackgroundBrush2"); ContentControl lblClass = new ContentControl(); lblClass.SetResourceReference(ContentControl.ContentTemplateProperty, "RouteAirlinerClassItem"); lblClass.Content = rClass; brdToolTip.Child = lblClass; imgInfo.ToolTip = brdToolTip; panelClassButtons.Children.Add(imgInfo); lbRouteInfo.Items.Add(new QuickInfoValue(new TextUnderscoreConverter().Convert(type, null, null, null).ToString(), panelClassButtons)); } } if (this.Route.Type == Model.AirlinerModel.RouteModel.Route.RouteType.Mixed || this.Route.Type == Model.AirlinerModel.RouteModel.Route.RouteType.Cargo) { this.CargoPrice = ((CargoRoute)this.Route).PricePerUnit; WrapPanel panelCargo = new WrapPanel(); txtCargo = UICreator.CreateTextBlock(new ValueCurrencyConverter().Convert(this.CargoPrice).ToString()); txtCargo.VerticalAlignment = System.Windows.VerticalAlignment.Bottom; panelCargo.Children.Add(txtCargo); Button btnEditCargo = new Button(); btnEditCargo.Margin = new Thickness(5, 0, 0, 0); btnEditCargo.Background = Brushes.Transparent; btnEditCargo.Click += new RoutedEventHandler(btnEditCargo_Click); Image imgEdit = new Image(); imgEdit.Width = 16; imgEdit.Source = new BitmapImage(new Uri(@"/Data/images/edit.png", UriKind.RelativeOrAbsolute)); RenderOptions.SetBitmapScalingMode(imgEdit, BitmapScalingMode.HighQuality); btnEditCargo.Content = imgEdit; panelCargo.Children.Add(btnEditCargo); lbRouteInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelRoute","1015"),panelCargo)); } foreach (StopoverRoute stopover in this.Route.Stopovers) { foreach (Route leg in stopover.Legs) { lbRouteInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelRoute", "1005"), UICreator.CreateTextBlock(string.Format("{0}-{1}", new AirportCodeConverter().Convert(leg.Destination1), new AirportCodeConverter().Convert(leg.Destination2))))); if (this.Route.Type == Route.RouteType.Passenger || this.Route.Type == Route.RouteType.Mixed) { this.Classes.Add(leg, new Dictionary<AirlinerClass.ClassType, RouteAirlinerClass>()); foreach (AirlinerClass.ClassType type in Enum.GetValues(typeof(AirlinerClass.ClassType))) { RouteAirlinerClass rClass = ((PassengerRoute)leg).getRouteAirlinerClass(type); this.Classes[leg].Add(type, rClass); WrapPanel panelClassButtons = new WrapPanel(); Button btnEdit = new Button(); btnEdit.Background = Brushes.Transparent; btnEdit.Tag = new KeyValuePair<Route, AirlinerClass.ClassType>(leg, type); btnEdit.Click += new RoutedEventHandler(btnEdit_Click); Image imgEdit = new Image(); imgEdit.Width = 16; imgEdit.Source = new BitmapImage(new Uri(@"/Data/images/edit.png", UriKind.RelativeOrAbsolute)); RenderOptions.SetBitmapScalingMode(imgEdit, BitmapScalingMode.HighQuality); btnEdit.Content = imgEdit; btnEdit.Visibility = this.Route.HasAirliner && (this.Route.getCurrentAirliner() != null && this.Route.getCurrentAirliner().Status != FleetAirliner.AirlinerStatus.Stopped) ? Visibility.Collapsed : System.Windows.Visibility.Visible; panelClassButtons.Children.Add(btnEdit); Image imgInfo = new Image(); imgInfo.Width = 16; imgInfo.Source = new BitmapImage(new Uri(@"/Data/images/info.png", UriKind.RelativeOrAbsolute)); imgInfo.Margin = new Thickness(5, 0, 0, 0); imgInfo.VerticalAlignment = System.Windows.VerticalAlignment.Bottom; RenderOptions.SetBitmapScalingMode(imgInfo, BitmapScalingMode.HighQuality); Border brdToolTip = new Border(); brdToolTip.Margin = new Thickness(-4, 0, -4, -3); brdToolTip.Padding = new Thickness(5); brdToolTip.SetResourceReference(Border.BackgroundProperty, "HeaderBackgroundBrush2"); ContentControl lblClass = new ContentControl(); lblClass.SetResourceReference(ContentControl.ContentTemplateProperty, "RouteAirlinerClassItem"); lblClass.Content = rClass; brdToolTip.Child = lblClass; imgInfo.ToolTip = brdToolTip; panelClassButtons.Children.Add(imgInfo); lbRouteInfo.Items.Add(new QuickInfoValue(new TextUnderscoreConverter().Convert(type).ToString(), panelClassButtons)); } } } } int numberOfInboundFlights = this.Route.TimeTable.Entries.Count(e => e.DepartureAirport == this.Route.Destination2); int numberOfOutboundFlights = this.Route.TimeTable.Entries.Count(e => e.DepartureAirport == this.Route.Destination1); lbRouteInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelRoute", "1006"), UICreator.CreateTextBlock(string.Format("{0} / {1}", numberOfOutboundFlights, numberOfInboundFlights)))); WrapPanel buttonsPanel = new WrapPanel(); buttonsPanel.Margin = new Thickness(0, 5, 0, 0); this.Children.Add(buttonsPanel); buttonsPanel.Visibility = this.Route.HasAirliner && (this.Route.getCurrentAirliner() != null && this.Route.getCurrentAirliner().Status != FleetAirliner.AirlinerStatus.Stopped) ? Visibility.Collapsed : System.Windows.Visibility.Visible; Button btnOk = new Button(); btnOk.SetResourceReference(Button.StyleProperty, "RoundedButton"); btnOk.Height = Double.NaN; btnOk.Width = Double.NaN; btnOk.Uid = "100"; btnOk.Content = Translator.GetInstance().GetString("General", btnOk.Uid); btnOk.SetResourceReference(Button.BackgroundProperty, "ButtonBrush"); btnOk.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; btnOk.Click += new RoutedEventHandler(btnOk_Click); buttonsPanel.Children.Add(btnOk); Button btnLoad = new Button(); btnLoad.SetResourceReference(Button.StyleProperty, "RoundedButton"); btnLoad.Height = Double.NaN; btnLoad.Width = Double.NaN; btnLoad.Uid = "115"; btnLoad.Content = Translator.GetInstance().GetString("General", btnLoad.Uid); btnLoad.SetResourceReference(Button.BackgroundProperty, "ButtonBrush"); btnLoad.Click += new RoutedEventHandler(btnLoad_Click); btnLoad.Margin = new Thickness(5, 0, 0, 0); btnLoad.Visibility = this.Route.Type == Route.RouteType.Cargo ? Visibility.Collapsed : System.Windows.Visibility.Visible; buttonsPanel.Children.Add(btnLoad); Button btnDelete = new Button(); btnDelete.SetResourceReference(Button.StyleProperty, "RoundedButton"); btnDelete.Height = Double.NaN; btnDelete.Width = Double.NaN; btnDelete.Uid = "200"; btnDelete.Content = Translator.GetInstance().GetString("PanelRoute", btnDelete.Uid); btnDelete.SetResourceReference(Button.BackgroundProperty, "ButtonBrush"); btnDelete.Margin = new System.Windows.Thickness(5, 0, 0, 0); btnDelete.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; btnDelete.Click += new RoutedEventHandler(btnDelete_Click); buttonsPanel.Children.Add(btnDelete); //if (this.Route.HasStopovers) { this.Children.Add(createStopoverStatisticsPanel()); } //else { // this.Children.Add(createRouteFinancesPanel()); } showRouteFinances(); }