public override void ViewDidLoad() { base.ViewDidLoad(); CustomNavigationBar.TintColor = StyleHelper.Style.AccentColor; if (StyleHelper.Style.UseLogoInsteadOfConnectionStatus) { var titleImage = new UIImageView { Image = UIImage.FromBundle(StyleHelper.Style.LogoBoundleName) }; CustomNavigationItem.AddTitleView(titleImage); } else { _customTitleView = new ConnectionStatusView(CGRect.Empty); CustomNavigationItem.AddTitleView(_customTitleView); } CustomNavigationItem.SetCommand(UIBarButtonSystemItem.Add, ViewModel.CreateChatCommand, false); ChatsTableView.RegisterNibForCellReuse(ChatSummaryViewCell.Nib, ChatSummaryViewCell.Key); ChatsTableView.RowHeight = 80; ChatsTableView.TableFooterView = new UIView(); var source = ViewModel.Chats.GetTableViewSource((cell, viewModel, index) => { (cell as ChatSummaryViewCell).BindViewModel(viewModel); }, ChatSummaryViewCell.Key); ChatsTableView.Source = source; ChatsTableView.Delegate = new CustomViewDelegate(source, ViewModel); _sourceRef = WeakReferenceEx.Create(source); }
void ReleaseDesignerOutlets() { if (CustomNavigationBar != null) { CustomNavigationBar.Dispose(); CustomNavigationBar = null; } if (CustomNavigationItem != null) { CustomNavigationItem.Dispose(); CustomNavigationItem = null; } if (TableView != null) { TableView.Dispose(); TableView = null; } if (ProgressIndicator != null) { ProgressIndicator.Dispose(); ProgressIndicator = null; } }
void ReleaseDesignerOutlets() { if (ChatsTableView != null) { ChatsTableView.Dispose(); ChatsTableView = null; } if (LoginButton != null) { LoginButton.Dispose(); LoginButton = null; } if (CustomNavigationItem != null) { CustomNavigationItem.Dispose(); CustomNavigationItem = null; } if (CustomNavigationBar != null) { CustomNavigationBar.Dispose(); CustomNavigationBar = null; } }
void ReleaseDesignerOutlets() { if (CustomNavigationBar != null) { CustomNavigationBar.Dispose(); CustomNavigationBar = null; } if (CustomNavigationItem != null) { CustomNavigationItem.Dispose(); CustomNavigationItem = null; } if (MainView != null) { MainView.Dispose(); MainView = null; } if (MainViewBottomConstraint != null) { MainViewBottomConstraint.Dispose(); MainViewBottomConstraint = null; } if (ScrollToBottomButton != null) { ScrollToBottomButton.Dispose(); ScrollToBottomButton = null; } }
private void InitNavigationBar() { CustomNavigationItem.Title = ViewModel.LocalizedStrings.DetailsTitle; CustomNavigationItem.SetCommand( UIImage.FromBundle(StyleHelper.Style.BackButtonBundleName), ViewModel.BackCommand, true); }
private void InitNavigationBar() { CustomNavigationItem.Title = ViewModel.LocalizedStrings.CreateGroup; CustomNavigationItem.SetCommand( UIImage.FromBundle(StyleHelper.Style.BackButtonBundleName), ViewModel.BackCommand, true); CustomNavigationItem.SetCommand( ViewModel.LocalizedStrings.Create, StyleHelper.Style.AccentColor, new RelayCommand(AddChat), false); }
public CustomNavigationItem CreateCustomNavigationItem(CustomNavigationItem item) { SecurityContext.DemandPermissions(SecutiryConstants.EditPortalSettings); var settings = CustomNavigationSettings.Load(); var exist = false; foreach (var existItem in settings.Items) { if (existItem.Id != item.Id) { continue; } existItem.Label = item.Label; existItem.Url = item.Url; existItem.ShowInMenu = item.ShowInMenu; existItem.ShowOnHomePage = item.ShowOnHomePage; if (existItem.SmallImg != item.SmallImg) { StorageHelper.DeleteLogo(existItem.SmallImg); existItem.SmallImg = StorageHelper.SaveTmpLogo(item.SmallImg); } if (existItem.BigImg != item.BigImg) { StorageHelper.DeleteLogo(existItem.BigImg); existItem.BigImg = StorageHelper.SaveTmpLogo(item.BigImg); } exist = true; break; } if (!exist) { item.Id = Guid.NewGuid(); item.SmallImg = StorageHelper.SaveTmpLogo(item.SmallImg); item.BigImg = StorageHelper.SaveTmpLogo(item.BigImg); settings.Items.Add(item); } settings.Save(); MessageService.Send(HttpContext.Current.Request, MessageAction.CustomNavigationSettingsUpdated); return(item); }
public override void ViewDidLoad() { base.ViewDidLoad(); _customTitleView = new ConnectionStatusView(CGRect.Empty); TableNode = new ASTableNode(UITableViewStyle.Grouped); Table = TableNode.View; Input = new ChatInputView() { TranslatesAutoresizingMaskIntoConstraints = false }; Input.Init(this); CustomNavigationItem.AddTitleView(_customTitleView); CustomNavigationItem.SetCommand( UIImage.FromBundle(StyleHelper.Style.BackButtonBundleName), ViewModel.BackCommand, true); if (ViewModel.HasInfo) { CustomNavigationItem.SetCommand( UIImage.FromBundle(StyleHelper.Style.ChatDetailsButtonBundleName), ViewModel.ShowInfoCommand, false); } MainView.InsertSubview(Table, 1); InitTableView(); _contextMenuHandler = new ContextMenuHandler <ChatMessageViewModel>(CreateContextMenuComponentForViewModel); Input.EditingCloseButton.SetCommand(ViewModel.MessageInput.CancelEditingCommand); Input.OpenCameraButton.SetCommand(ViewModel.MessageInput.OpenCameraCommand); Input.OpenGalleryButton.SetCommand(ViewModel.MessageInput.OpenGalleryCommand); Input.SendButton.SetCommand(ViewModel.MessageInput.SendMessageCommand); Input.DeleteButton.SetCommand(ViewModel.MessageInput.DeleteImageCommand); Input.SetLabels( ViewModel.MessageInput.EditMessageHeaderString, ViewModel.MessageInput.EnterMessagePlaceholderString); ScrollToBottomButton.SetCommand(new RelayCommand(() => ScrollToBottom(true))); ScrollToBottomButton.SetBackgroundImage(UIImage.FromBundle(StyleHelper.Style.ScrollDownBoundleName), UIControlState.Normal); }
public CustomNavigationItem GetCustomNavigationItemSample() { return(CustomNavigationItem.GetSample()); }
protected override void DoAttachBindings() { base.DoAttachBindings(); Bindings.Add(this.SetBinding(() => ViewModel.HeaderViewModel.AvatarUrl).WhenSourceChanges(() => { _chatDetailsHeaderView.SetChatAvatar(ViewModel.HeaderViewModel.AvatarUrl, ViewModel.HeaderViewModel.ChatName); })); Bindings.Add(this.SetBinding(() => ViewModel.HeaderViewModel.ChatName, () => _chatDetailsHeaderView.ChatNameField.Text, BindingMode.TwoWay)); Bindings.Add(this.SetBinding(() => ViewModel.HeaderViewModel.ChatName).WhenSourceChanges(() => { var chatName = ViewModel.HeaderViewModel.ChatName; if (!string.IsNullOrEmpty(chatName) && !ViewModel.CanEdit) { _chatDetailsHeaderView.ChatNameTextView.Text = chatName; _chatDetailsHeaderView.ChatNameTextView.EnableAutoScroll(); } })); Bindings.Add(this.SetBinding(() => ViewModel.HeaderViewModel.IsMuted, () => _chatDetailsHeaderView.IsNotificationsMuted)); Bindings.Add(this.SetBinding(() => ViewModel.HeaderViewModel.IsBusy, () => _chatDetailsHeaderView.IsMuteNotificationsAvailable) .ConvertSourceToTarget(x => !x)); Bindings.Add(this.SetBinding(() => ViewModel.MembersCountText, () => _chatDetailsHeaderView.ChatMembersCount)); Bindings.Add(this.SetBinding(() => _simpleImagePicker.ViewModel.ImageCacheKey).WhenSourceChanges(() => { var newImageCacheKey = _simpleImagePicker.ViewModel.ImageCacheKey; if (string.IsNullOrEmpty(newImageCacheKey) || newImageCacheKey == _previewImageKey) { return; } _previewImageKey = newImageCacheKey; _chatDetailsHeaderView.SetEditedChatAvatar(_previewImageKey); Execute.BeginOnUIThread(() => { ViewModel.HeaderViewModel.StartEditingCommand.Execute(null); }); })); Bindings.Add(this.SetBinding(() => ViewModel.IsLoading).WhenSourceChanges(() => { if (ViewModel.IsLoading) { BusyIndicator.StartAnimating(); } else { BusyIndicator.StopAnimating(); } _chatDetailsHeaderView.MembersCountLabelHidden = ViewModel.IsLoading; })); Bindings.Add(this.SetBinding(() => ViewModel.CanEdit).WhenSourceChanges(() => { _chatDetailsHeaderView.HideChangeChatPhoto(!ViewModel.CanEdit); _chatDetailsHeaderView.EnableEditMode(ViewModel.CanEdit); if (!ViewModel.CanEdit) { _chatDetailsHeaderView.Frame = new CGRect(0, 0, 200, 260); return; } if (!_isChangeChatPhotoInitialized) { _chatDetailsHeaderView.SetChangeChatPhotoCommand(new RelayCommand(OpenPicker), ViewModel.LocalizedStrings.ChangePhoto); _chatDetailsHeaderView.SetChangeChatName(ViewModel.HeaderViewModel.StartEditingCommand); _isChangeChatPhotoInitialized = true; } })); Bindings.Add(this.SetBinding(() => ViewModel.HeaderViewModel.IsInEditMode).WhenSourceChanges(() => { if (ViewModel.HeaderViewModel.IsInEditMode) { CustomNavigationItem.SetCommand(ViewModel.LocalizedStrings.Save, UIColor.Black, new RelayCommand(Save), false); } else { CustomNavigationItem.SetRightBarButtonItem(null, true); _chatDetailsHeaderView.EndEditing(); } })); }