Пример #1
0
        private PersonsViewModel()
        {
            _dlgCoord   = DialogCoordinator.Instance;
            _dispatcher = Application.Current.Dispatcher;
            _dlgSet     = DialogSettings.Instance;

            LoadedCmd     = new RelayCommandAsync(LoadedAsync);
            RefreshCmd    = new RelayCommandAsync(RefreshAsync);
            NewPersonCmd  = new RelayCommandAsync(NewPersonAsync);
            EditPersonCmd = new RelayCommandAsync(EditPersonAsync);
            OpenPersonCmd = new RelayCommandAsync(OpenPersonAsync);
        }
Пример #2
0
    void Start()
    {
        dialogue   = DialogSettings.Load(asset);
        mainCamera = GameObject.FindWithTag("MainCamera");

        // get animator from text
        curDialogueTextController  = curDialogue_Text.GetComponent <Animator>();
        moveDialogueTextController = moveDialogue_Text.GetComponent <Animator>();
        prevDialogueTextController = prevDialogue_Text.GetComponent <Animator> ();

        //character_image.GetComponent<Animator>().SetTrigger("go");
    }
Пример #3
0
        private void ShowProgressDialog(string title, bool animateShow, bool animateHide, bool cancellable)
        {
            var settings = new DialogSettings
            {
                UseAnimationOnShow = animateShow,
                UseAnimationOnHide = animateHide
            };

            var task = DialogManager.Instance.ShowProgressAsync(title, string.Empty, cancellable, settings);

            task.Wait();
            _progressController = task.Result;
        }
        public void NativeDialogSettingsParity()
        {
            // Arrange
            var settingsPropertyNames = string.Join(
                ", ",
                DialogSettings.GetPropertyNames(typeof(FolderBrowserDialogSettings)));

            var dialogPropertyNames = string.Join(
                ", ",
                DialogSettings.GetPropertyNames(typeof(FolderBrowserDialog)).Except(DialogSettings.ExcludedPropertyNames));

            // Assert
            Assert.That(settingsPropertyNames, Is.EqualTo(dialogPropertyNames));
        }
        public void NativeDialogSettingsParity()
        {
            // Arrange
            var messageBoxSettingsPropertyNames = string.Join(
                ", ",
                DialogSettings.GetPropertyNames(typeof(MessageBoxSettings)));

            var messageBoxPropertyNames = string.Join(
                ", ",
                DialogSettings.GetMessageBoxParameters().Except(DialogSettings.ExcludedMessageBoxPropertyNames));

            // Assert
            Assert.That(messageBoxSettingsPropertyNames, Is.EqualTo(messageBoxPropertyNames));
        }
Пример #6
0
 public DialogModel(DialogSettings settings)
 {
     _selectedDate          = settings.SelectedDate.Value;
     _selectedHour          = settings.SelectedHour.Value;
     _selectedMinute        = settings.SelectedMinute.Value;
     _minimumDate           = settings.MinimumDate.Value;
     _maximumDate           = settings.MaximumDate.Value;
     _cancelButton          = settings.CancelButtonText;
     _okButton              = settings.OkButtonText;
     _backgroudColor        = settings.BackgroudColor.Value;
     _buttonsColor          = settings.ButtonsColor.Value;
     _hourMinColor          = settings.HourMinTextColor.Value;
     _currentMonthDaysColor = settings.CurrentMonthDaysColor.Value;
 }
Пример #7
0
        public void ChainedCalls_ShouldSet_AllProperties()
        {
            const string message       = "Message text";
            const string primaryText   = "Secondary button text";
            const string secondaryText = "Secondary button text";

            var settings = DialogSettings.FromMessage(message)
                           .WithPrimaryButtonText(primaryText)
                           .WithSecondaryButtonText(secondaryText);

            settings.Message.Should().Be(message);
            settings.PrimaryButtonText.Should().Be(primaryText);
            settings.SecondaryButtonText.Should().Be(secondaryText);
        }
Пример #8
0
        public void Export()
        {
            var dialogSettings = new DialogSettings();

            dialogSettings.Title = "Сохранить";
            dialogSettings.DefaultFileExtention = ".xlsx";
            dialogSettings.FileName             = $"{"Доставка за час"} {DateTime.Now:yyyy-MM-dd-HH-mm}.xlsx";

            var result = _fileDialogService.RunSaveFileDialog(dialogSettings);

            if (result.Successful)
            {
                SaveReport(result.Path);
            }
        }
Пример #9
0
        public bool OpenDatabaseProperties(DatabaseReference database)
        {
            var vm = IoC.Get <IDatabasePropertiesView>();

            vm.Init(database);

            var dialogSettings = new DialogSettings
            {
                Width         = 480,
                SizeToContent = SizeToContent.Height,
                ResizeMode    = ResizeMode.NoResize
            };

            return(_windowManager.ShowDialog(vm, null, dialogSettings.Settings) == true);
        }
Пример #10
0
        public static MetroDialogSettings ToMetroDialogSettings(this DialogSettings dialogSettings)
        {
            if (dialogSettings == null)
            {
                return(null);
            }

            return(new MetroDialogSettings
            {
                AffirmativeButtonText = dialogSettings.AffirmativeButtonText,
                FirstAuxiliaryButtonText = dialogSettings.FirstAuxiliaryButtonText,
                NegativeButtonText = dialogSettings.NegativeButtonText,
                SecondAuxiliaryButtonText = dialogSettings.SecondAuxiliaryButtonText
            });
        }
Пример #11
0
 private void SaveSettings(DialogSettings aSettings)
 {
     lock (iLock)
     {
         string     xPath    = string.Format("//dialog[@name='{0}']", aSettings.Name);
         XmlElement existing = iSettingsXml.SelectSingleNode(xPath) as XmlElement;
         if (existing == null)
         {
             existing = aSettings.Create(iSettingsXml);
             iSettingsXml.DocumentElement.AppendChild(existing);
         }
         aSettings.Save(existing);
         iSaveTimer.Change(kSaveTimeoutMilliseconds, Timeout.Infinite);
     }
 }
Пример #12
0
        public override void Execute(VkApi vk, Message message, string sourceQuery)
        {
            var query   = ExtractQuery(sourceQuery);
            var command = CommandUtils.AllCommands.FirstOrDefault(x => x.IsIt(query));

            if (command == null)
            {
                var dialog = DialogSettings.GetSession(vk, message);
                var result = Utils.GetWhile(() => VkUtils.GetNextPictureAndMessageForDialog_Ad(vk, dialog), (res) => res.Key != null, 10);
                VkNet.VkUtils.SendImage(vk, message, result.Key, result.Value);
            }
            else
            {
                command.Execute(vk, message, query);
            }
        }
        public IncomingCallsAnalysisReportViewModel(
            IUnitOfWorkFactory uowFactory,
            INavigationManager navigationManager,
            IInteractiveService interactiveService,
            IPhoneRepository phoneRepository,
            IFileDialogService fileDialogService)
            : base(uowFactory, navigationManager)
        {
            Title = "Анализ входящих звонков";
            _interactiveService = interactiveService ?? throw new ArgumentNullException(nameof(interactiveService));
            _phoneRepository    = phoneRepository ?? throw new ArgumentNullException(nameof(phoneRepository));
            _fileDialogService  = fileDialogService ?? throw new ArgumentNullException(nameof(fileDialogService));

            _exportDialogSettings = CreateExportDialogSettings();
            _loadDialogSettings   = CreateLoadDialogSettings();
        }
        public override void Execute(VkApi vk, Message message, string sourceQuery)
        {
            var setIntervalCommand = CommandUtils.AllCommands.Single(x => x is SetIntervalValueCommand);
            var extractedQuery     = this.ExtractQuery(sourceQuery);

            if (setIntervalCommand.IsIt(extractedQuery))
            {
                setIntervalCommand.Execute(vk, message, extractedQuery);
            }
            else
            {
                var session = DialogSettings.GetSession(vk, message);
                session.IntervalDispatchingValue = 1;
                session.StartIntervalDispatching();
            }
        }
Пример #15
0
        public ImportPaymentsFromAvangardSbpViewModel(
            IUnitOfWorkFactory unitOfWorkFactory,
            INavigationManager navigation,
            IInteractiveService interactiveService,
            IFileDialogService fileDialogService,
            IPaymentFromAvangardFactory paymentFromAvangardFactory,
            IPaymentsRepository paymentsRepository
            ) : base(unitOfWorkFactory, navigation)
        {
            _interactiveService         = interactiveService ?? throw new ArgumentNullException(nameof(interactiveService));
            _fileDialogService          = fileDialogService ?? throw new ArgumentNullException(nameof(fileDialogService));
            _paymentFromAvangardFactory = paymentFromAvangardFactory ?? throw new ArgumentNullException(nameof(paymentFromAvangardFactory));
            _paymentsRepository         = paymentsRepository ?? throw new ArgumentNullException(nameof(paymentsRepository));

            _loadDialogSettings = CreateLoadDialogSettings();
            Title = "Загрузка реестра оплат из Авангарда";
        }
Пример #16
0
        public DialogSettings SaveSettings()
        {
            var settings = new DialogSettings();

            if (this.WindowState == FormWindowState.Normal)
            {
                settings.Size     = this.Bounds.Size;
                settings.Location = this.Bounds.Location;
            }
            else
            {
                settings.Size     = this.RestoreBounds.Size;
                settings.Location = this.RestoreBounds.Location;
            }
            settings.WindowState = this.WindowState;
            return(settings);
        }
Пример #17
0
        public override void Execute(VkApi vk, Message message, string sourceQuery)
        {
            var targetQuery = sourceQuery.Substring(0, sourceQuery.Length - ExtractQuery(sourceQuery).Length);

            var value = ExtractValue(targetQuery);

            if (value < 1)
            {
                VkNet.VkUtils.SendMessage(vk, message, StringConstants.Dialog_IntervalCannotBeLessThan1);
            }
            else
            {
                var session = DialogSettings.GetSession(vk, message);
                session.IntervalDispatchingValue = value;
                session.StartIntervalDispatching();
            }
        }
Пример #18
0
        private async void BtnOpenDialog1_Clicked(object sender, EventArgs e)
        {
            DialogSettings settings = new DialogSettings();

            settings.SelectedDate          = DateTime.Now.AddDays(-1);
            settings.MinimumDate           = DateTime.Now.AddDays(-10);
            settings.MaximumDate           = DateTime.Now.AddDays(10);
            settings.SelectedHour          = DateTime.Now.Hour;
            settings.SelectedMinute        = DateTime.Now.Minute;
            settings.HourMinTextColor      = Color.Red;
            settings.CurrentMonthDaysColor = Color.Blue;
            var result = await new DateTimePickerDialog().Show(this, settings);

            if (result != null)
            {
                await DisplayAlert("Result", "Selected: " + result.Value.ToString("dd MMM yyyy HH:mm"), "Cancel");
            }
        }
Пример #19
0
    /// <summary>
    /// Shows the dialog settings.
    /// </summary>
    public void ShowDialogSettings()
    {
        // TODO: Get the dialog.
        var dialog = GetTheDialog <DialogSettings> (prefabDialogSettings, dialogSettings);

        // TODO: Check if this null.
        if (object.ReferenceEquals(dialog, null))
        {
            // TODO: Break the functions.
            return;
        }

        // TODO: set the default dialog.
        dialogSettings = dialog;

        // TODO: Show the dialog.
        DoShow(dialog);;
    }
Пример #20
0
 private DialogSettings LoadSettings(string aName, Window aDialog)
 {
     lock (iLock)
     {
         string         xPath        = string.Format("//dialog[@name='{0}']", aName);
         XmlElement     settingsElem = iSettingsXml.SelectSingleNode(xPath) as XmlElement;
         DialogSettings settings;
         if (settingsElem != null)
         {
             settings = new DialogSettings(settingsElem);
             settings.Apply(aDialog);
         }
         else
         {
             settings = new DialogSettings(aDialog, aName);
             SaveSettings(settings);
         }
         return(settings);
     }
 }
        private IDialogResult RunWindowsOpenDirectoryDialog(DialogSettings dialogSettings)
        {
            using (FolderBrowserDialog folderDialog = new FolderBrowserDialog())
            {
                folderDialog.Description         = dialogSettings.Title;
                folderDialog.ShowNewFolderButton = true;
                folderDialog.SelectedPath        = dialogSettings.InitialDirectory;
                folderDialog.RootFolder          = Environment.SpecialFolder.Desktop;

                IDialogResult result;

                if (folderDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    result = new DialogResult(folderDialog.SelectedPath, new[] { folderDialog.SelectedPath });
                }
                else
                {
                    result = new DialogResult();
                }

                return(result);
            }
        }
        private IDialogResult RunGtkOpenDirectoryDialog(DialogSettings dialogSettings)
        {
            FileChooserDialog fileDialog = new FileChooserDialog(dialogSettings.Title, null, FileChooserAction.SelectFolder, "Выбрать", ResponseType.Accept, "Отмена", ResponseType.Cancel);

            fileDialog.SetCurrentFolder(dialogSettings.InitialDirectory);

            IDialogResult result;

            var runDialogResult = (ResponseType)fileDialog.Run();

            if (runDialogResult == ResponseType.Accept)
            {
                result = new DialogResult(fileDialog.Filename, fileDialog.Filenames);
            }
            else
            {
                result = new DialogResult();
            }

            fileDialog.Destroy();

            return(result);
        }
Пример #23
0
        /// <summary>
        /// Notify the user than an except has occurred and the exception message.
        /// </summary>
        /// <param name="ex">An exception to relay to the user</param>
        /// <param name="timeout">Removes the dialogue if it is still running after this amount of milliseconds</param>
        /// <param name="cancellationToken">Removes the dialogue if it is still running</param>
        /// <returns><see langword="true"/> when the user has acknowledged the message</returns>
        public async Task <bool> ExceptionDialog(Exception ex, int timeout = 5000, CancellationToken cancellationToken = default)
        {
            _log.LogDebug($"{nameof(ExceptionDialog)} initiated.");

            var errorTitle   = "An error occurred";
            var errorMessage = "";

            if (ex is COMException)
            {
                errorTitle   = "Scanner communication error";
                errorMessage = "A error occurred when attempting to communicate with a device";
            }

            IDialogSettings dialogSettings = new DialogSettings
            {
                AffirmativeButtonText = "OK",
                CancellationToken     = cancellationToken
            };

            // Show the dialogue until user input is recieved, or scanning is otherwise stopped
            var dialogResult = await _dialogManager.ShowMessageWithTimeoutAsync(
                _context,
                errorTitle,
                $"{errorMessage}{Environment.NewLine}{ex.GetType()}{Environment.NewLine}{ex.Message}",
                DialogStyle.Affirmative,
                dialogSettings,
                timeout);

            if (dialogResult == DialogResult.Canceled)
            {
                _log.LogDebug($"{nameof(ExceptionDialog)} closed by CancellationToken before user input recieved");
            }

            _log.LogDebug($"User input return from {nameof(ExceptionDialog)}: {dialogResult}");

            return(dialogResult == DialogResult.Affirmative);
        }
        public IDialogResult RunOpenFileDialog(DialogSettings dialogSettings)
        {
            switch (dialogSettings.PlatformType)
            {
            case DialogPlatformType.Auto:
                if (IsWindows())
                {
                    return(RunWindowsOpenFileDialog(dialogSettings));
                }
                else
                {
                    return(RunGtkOpenFileDialog(dialogSettings));
                }

            case DialogPlatformType.Crossplatform:
                return(RunGtkOpenFileDialog(dialogSettings));

            case DialogPlatformType.Windows:
                return(RunWindowsOpenFileDialog(dialogSettings));

            default:
                throw new NotSupportedException($"Тип {dialogSettings.PlatformType} не поддерживается");
            }
        }
Пример #25
0
        public MainViewModel()
        {
            _dlgCoord   = DialogCoordinator.Instance;
            _dispatcher = Application.Current.Dispatcher;
            _dlgSet     = DialogSettings.Instance;

            CloseCmd          = new DelegateCommand(CloseApp);
            TestCmd           = new RelayCommandAsync(TestAsync);
            AboutFlyoutCmd    = new RelayCommand(ShowFlyoutAbout);
            SettingsFlyoutCmd = new RelayCommand(ShowFlyoutSettings);

            var home = new MenuItem
            {
                Name    = LocalizationProvider.GetLocalizedValue <string>("Home"),
                Text    = LocalizationProvider.GetLocalizedValue <string>("Home"),
                ToolTip = LocalizationProvider.GetLocalizedValue <string>("Home"),
                Icon    = new PackIcon
                {
                    Kind   = PackIconKind.Home,
                    Width  = 32,
                    Height = 32,
                    HorizontalAlignment = HorizontalAlignment.Center,
                    VerticalAlignment   = VerticalAlignment.Center,
                },
                Content = new HomeView()
            };

            var contacts = new MenuItem
            {
                //Name = LocalizeDictionary.Instance.GetLocalizedObject("Contacts", null, LocalizeDictionary.Instance.Culture).ToString(),
                Name    = LocalizationProvider.GetLocalizedValue <string>("Contacts"),
                Text    = LocalizationProvider.GetLocalizedValue <string>("Contacts"),
                ToolTip = LocalizationProvider.GetLocalizedValue <string>("Contacts"),
                Icon    = new PackIcon
                {
                    Kind   = PackIconKind.Contacts,
                    Width  = 32,
                    Height = 32,
                    HorizontalAlignment = HorizontalAlignment.Center,
                    VerticalAlignment   = VerticalAlignment.Center,
                },
                Content = new PersonsView()
            };

            MenuItems = new[]
            {
                home,
                contacts
            };

            Notifier = new Notifier(toast =>
            {
                toast.PositionProvider = new WindowPositionProvider(
                    parentWindow: Application.Current.MainWindow,
                    corner: Corner.BottomRight,
                    offsetX: 25,
                    offsetY: 25);

                toast.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor(
                    notificationLifetime: TimeSpan.FromSeconds(5),
                    maximumNotificationCount: MaximumNotificationCount.FromCount(3));

                toast.DisplayOptions.TopMost = false;
                toast.DisplayOptions.Width   = 250;
            });

            Notifier.ClearMessages();
        }
Пример #26
0
 public void LoadSettings(DialogSettings settings)
 {
     this.Size        = settings.Size;
     this.Location    = settings.Location;
     this.WindowState = settings.WindowState;
 }
Пример #27
0
 public void ShowOverlayDialog(IViewModel overlayContent, DialogSettings dialogSettings)
 {
     this._shellController.ShowOverlayDialog(overlayContent, dialogSettings);
 }
Пример #28
0
        private void SettingsClick(object sender, EventArgs e)
        {
            var test = new DialogSettings();

            test.ShowDialog();
        }
Пример #29
0
 public void Open(DialogSettings settings)
 {
     AppDialog.Open(settings);
     _statemachine.Next(State.Open);
 }
Пример #30
0
        /// <summary>
        /// This method is called when the activity is starting.
        /// It contains the logic for the buttons shown in this activity.
        /// </summary>
        /// <param name="savedInstanceState"> a Bundle that contains the data the activity most recently
        /// supplied if the activity is being re-initialized after previously being shut down. </param>
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.MyProfile);

            userJson    = Intent.GetStringExtra("User");
            _loggedUser = JsonConvert.DeserializeObject <User>(userJson);

            _nameView  = FindViewById <TextView>(Resource.Id.myNameView);
            _ageView   = FindViewById <TextView>(Resource.Id.myAgeView);
            _chefView  = FindViewById <TextView>(Resource.Id.chefText);
            _scoreText = FindViewById <TextView>(Resource.Id.scoreText);

            _pfp = FindViewById <ImageView>(Resource.Id.profilePic);

            _btnFollowers = FindViewById <Button>(Resource.Id.btnMyFollowers);
            _btnFollowing = FindViewById <Button>(Resource.Id.btnMyFollowing);
            _btnSettings  = FindViewById <Button>(Resource.Id.btnSettings);
            _btnNewsfeed  = FindViewById <Button>(Resource.Id.btnNewsfeed);
            _btnNotif     = FindViewById <Button>(Resource.Id.btnNotif);
            _btnDate      = FindViewById <Button>(Resource.Id.btnDate);
            _btnScore     = FindViewById <Button>(Resource.Id.btnScore);
            _btnDiff      = FindViewById <Button>(Resource.Id.btnDiff);
            _btnRecipe    = FindViewById <Button>(Resource.Id.btnRecipe);
            _btnChef      = FindViewById <Button>(Resource.Id.btnChef);
            _btnBusiness  = FindViewById <Button>(Resource.Id.btnCreateBsns);

            _myMenuListView = FindViewById <ListView>(Resource.Id.myMenuListView);

            _nameView.Text = "Name: " + _loggedUser.firstName + " " + _loggedUser.lastName;
            _ageView.Text  = "Age: " + _loggedUser.age;

            if (!string.IsNullOrEmpty(_loggedUser.photo))
            {
                pictureUrl = $"http://{MainActivity.Ipv4}:8080/CookTime_war/cookAPI/resources/getPicture?id={_loggedUser.photo}";
                Bitmap bitmap = GetImageBitmapFromUrl(pictureUrl);
                _pfp.SetImageBitmap(bitmap);
            }

            if (_loggedUser.chef)
            {
                _chefView.Text  = "Chef: yes";
                _scoreText.Text = "Score : " + _loggedUser.chefScore;
            }
            else
            {
                _chefView.Text  = "Chef: no";
                _scoreText.Text = "";
            }

            _btnFollowers.Text = "FOLLOWERS: " + _loggedUser.followerEmails.Count;
            _btnFollowing.Text = "FOLLOWING: " + _loggedUser.followingEmails.Count;

            using var webClient = new WebClient { BaseAddress = "http://" + MainActivity.Ipv4 + ":8080/CookTime_war/cookAPI/" };

            var url = "resources/myMenu?email=" + _loggedUser.email + "&filter=date";

            webClient.Headers[HttpRequestHeader.ContentType] = "application/json";
            var send = webClient.DownloadString(url);

            _myMenuList = JsonConvert.DeserializeObject <IList <string> >(send);

            _adapter = new RecipeAdapter(this, _myMenuList);
            _myMenuListView.Adapter    = _adapter;
            _myMenuListView.ItemClick += ListClick;

            _btnNewsfeed.Click += (sender, args) =>
            {
                using var webClient2 = new WebClient { BaseAddress = "http://" + MainActivity.Ipv4 + ":8080/CookTime_war/cookAPI/" };

                var url2 = "resources/getUser?id=" + _loggedUser.email;
                webClient2.Headers[HttpRequestHeader.ContentType] = "application/json";
                var request = webClient2.DownloadString(url2);

                var intent = new Intent(this, typeof(NewsfeedActivity));
                intent.PutExtra("User", request);

                StartActivity(intent);
                OverridePendingTransition(Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight);
                Finish();
            };

            _btnSettings.Click += (sender, args) =>
            {
                //Brings dialog fragment forward
                var transaction    = SupportFragmentManager.BeginTransaction();
                var dialogSettings = new DialogSettings();
                dialogSettings.Show(transaction, "settings");

                dialogSettings.Email             = _loggedUser.email;
                dialogSettings.EventHandlerPass += PassResult;
            };

            _btnFollowers.Click += (sender, args) =>
            {
                var intent = new Intent(this, typeof(FollowActivity));
                intent.PutExtra("Title", "Followers");
                intent.PutExtra("LoggedId", _loggedUser.email);
                intent.PutStringArrayListExtra("FollowList", _loggedUser.followerEmails);

                StartActivity(intent);
                OverridePendingTransition(Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight);
            };

            _btnFollowing.Click += (sender, args) =>
            {
                var intent = new Intent(this, typeof(FollowActivity));
                intent.PutExtra("Title", "Following");
                intent.PutExtra("LoggedId", _loggedUser.email);
                intent.PutStringArrayListExtra("FollowList", _loggedUser.followingEmails);

                StartActivity(intent);
                OverridePendingTransition(Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight);
            };

            _btnNotif.Click += (sender, args) =>
            {
                var intent = new Intent(this, typeof(NotifActivity));
                intent.PutStringArrayListExtra("NotifList", _loggedUser.notifications);
                intent.PutExtra("LoggedId", _loggedUser.email);

                StartActivity(intent);
                OverridePendingTransition(Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight);
            };

            _btnDate.Click += (sender, args) =>
            {
                sortStr = "date";
                SortMenu();
            };

            _btnScore.Click += (sender, args) =>
            {
                sortStr = "score";
                SortMenu();
            };

            _btnDiff.Click += (sender, args) =>
            {
                sortStr = "difficulty";
                SortMenu();
            };

            _btnRecipe.Click += (sender, args) =>
            {
                var intent = new Intent(this, typeof(CreateRActivity));
                intent.PutExtra("LoggedId", _loggedUser.email);

                StartActivity(intent);
                OverridePendingTransition(Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight);
            };

            _btnChef.Click += (sender, args) =>
            {
                if (_loggedUser.chef)
                {
                    var toast = Toast.MakeText(this, "You're already a chef", ToastLength.Short);
                    toast.Show();
                }
                else
                {
                    //Brings dialog fragment forward
                    var transaction = SupportFragmentManager.BeginTransaction();
                    var dialogChef  = new DialogChef();
                    dialogChef.LoggedId = _loggedUser.email;
                    dialogChef.Show(transaction, "chef");

                    dialogChef.EventHandlerChef += ChefResult;
                }
            };

            _btnBusiness.Click += (sender, args) =>
            {
                if (_loggedUser.business == 0)
                {
                    var intent = new Intent(this, typeof(CreateBActivity));
                    intent.PutExtra("LoggedId", _loggedUser.email);

                    StartActivity(intent);
                    OverridePendingTransition(Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight);
                }
                else
                {
                    using var webClient3 = new WebClient { BaseAddress = "http://" + MainActivity.Ipv4 + ":8080/CookTime_war/cookAPI/" };
                    var url3 = "resources/getBusiness?id=" + _loggedUser.business;
                    webClient3.Headers[HttpRequestHeader.ContentType] = "application/json";
                    var bsnsJson = webClient3.DownloadString(url3);

                    var intent = new Intent(this, typeof(MyBusiness));
                    intent.PutExtra("Bsns", bsnsJson);
                    intent.PutExtra("LoggedId", _loggedUser.email);
                    StartActivity(intent);
                    OverridePendingTransition(Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight);
                }
            };
            _pfp.Click += (sender, args) =>
            {
                var transaction   = SupportFragmentManager.BeginTransaction();
                var dialogPicture = new DialogPicture();
                dialogPicture.Photo = _loggedUser.photo;
                dialogPicture.Show(transaction, "choice");
                dialogPicture.EventHandlerChoice += PictureAction;
            };
        }