public MsgSearchPanel(ContentPage page, View subView = null, ListView lsView = null) { RelativeLayout rootLayout = page.Content as RelativeLayout; bottomView = subView ?? rootLayout.Children.Last(); listView = lsView ?? (ListView)rootLayout.Children.First() as ListView; source = (page as Views.MessagesPage).RootDialog; if (string.IsNullOrEmpty(source.Query)) { defaultTitle = page.Title; } else { // ((App.Current.MainPage as MasterDetailPage).Detail as NavPage).Title = "13"; page.Title = defaultTitle = page.Title.Split(' ').Last() + $"({source.Query})"; ((App.Current.MainPage as MasterDetailPage).Detail as NavPage).BarTextColor = Color.Orange; page.Disappearing += (sender, e) => { ((App.Current.MainPage as MasterDetailPage).Detail as NavPage).BarTextColor = Color.White; }; itemSource = listView.ItemsSource as IList <Model.Message>; /* * var item = itemSource.Last(m => m.Value.ToLower().Contains(source.Query.ToLower())); * listView.ScrollTo(item, ScrollToPosition.Start, false); * listView.SelectedItem = item;//*/ listView.ItemsSource = itemSource.Where(source.Filter).ToList(); } var number = source.Address.ToNumber().ToString(); if (number.ToNumber() > 0) { if (number.Length > 10) { number = "+" + number; } CreateCallButton(page, number); } page.ToolbarItems.Add(SearchButton = new SearchToolbarButton { ContentLayout = rootLayout, ItemClicked = () => SearchButton_Clicked(rootLayout), // Icon = new FileImageSource() { File = "d_search.png" } }); PageWidth = page.Width; }
public DlgSearchPanel(ContentPage page, View subView = null, ListView lstView = null) { AbsoluteLayout rootLayout = page.Content as AbsoluteLayout; bottomView = subView ?? rootLayout.Children.Last(); listView = lstView ?? (rootLayout.Children.First() as RefreshView).Content as ListView; page.ToolbarItems.Add(SearchButton = new SearchToolbarButton { ContentLayout = rootLayout, ItemClicked = () => SearchButton_Clicked(rootLayout) }); PageWidth = page.Width; // SearchButton.Clicked += (object sender, EventArgs e) => SearchButton_Clicked(rootLayout); }
private void CreateCallButton(ContentPage page, string number) { var callButton = new SearchToolbarButton { Order = ToolbarItemOrder.Primary, Icon = new FileImageSource { File = "phone2.png" }, Text = "Phone", Priority = 0, ItemClicked = () => { if (Options.ModelSettings.FastCall) { DependencyService.Get <Api.IEssential>().PhoneDialer(number); } else { try { Xamarin.Essentials.PhoneDialer.Open(number); // if (!DependencyService.Get<Api.ILowLevelApi>().IsEsentialInit) return; } catch (ArgumentNullException) { Api.Funcs.Toast("У вашего оппонента неподдерживаемый номер телефона"); } catch (Xamarin.Essentials.FeatureNotSupportedException) { Api.Funcs.Toast("Чуда не будет. Ваш девайс не умеет говорить"); } catch (Exception ex) { Cache.database.Insert(new Model.Errors { Name = ex.Message, Method = System.Reflection.MethodBase.GetCurrentMethod().Name, Params = number }); } } } }; page.ToolbarItems.Add(callButton); }