예제 #1
0
 public HairLengthImage(HairAppBl.Interfaces.IHairBl hairbl, HairLength hl)
 {
     mHairbl         = hairbl;
     HairLength      = hl;
     HeightRequest   = 70;
     BackgroundColor = Color.Transparent;
 }
예제 #2
0
        public NavigationControl(string leftButtonText, string rightButtonText, HairAppBl.Interfaces.IHairBl hairbl)
        {
            var grid = new Grid();

            grid.Style             = (Style)hairbl.Resources["NavigationControl"];
            grid.HorizontalOptions = LayoutOptions.FillAndExpand;

            grid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Star)
            });
            grid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });
            grid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });

            LeftButton = new Button {
                Text = leftButtonText, HorizontalOptions = LayoutOptions.Fill, BackgroundColor = Color.Transparent
            };
            RightButton = new Button {
                Text = rightButtonText, HorizontalOptions = LayoutOptions.Fill, BackgroundColor = Color.Transparent
            };

            grid.Children.Add(LeftButton, 0, 0);
            grid.Children.Add(RightButton, 1, 0);
            View = grid;
        }
예제 #3
0
        public AddRoutineCell(RoutineCellObject rcObject, HairAppBl.Interfaces.IHairBl hairbl)
        {
            cellObject = rcObject;

            mCheckBox = new XLabs.Forms.Controls.CheckBox();
            mCheckBox.CheckedChanged += MCheckBox_CheckedChanged;

            var tapGestureRecognizer = new TapGestureRecognizer();

            tapGestureRecognizer.Tapped += (s, e) => {
                mCheckBox.Checked = !mCheckBox.Checked;
            };

            var label1 = new Label
            {
                Text           = rcObject.Name,
                FontSize       = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
                FontAttributes = FontAttributes.Bold
            };

            var frame = new Frame
            {
                Style   = (Style)hairbl.Resources["RoutineFrameSelect"],
                Content = new StackLayout
                {
                    Style       = (Style)hairbl.Resources["RoutineContent"],
                    Orientation = StackOrientation.Horizontal,

                    Children = { mCheckBox, label1 }
                }
            };

            frame.GestureRecognizers.Add(tapGestureRecognizer);
            View = frame;
        }
예제 #4
0
 public SingleRoutineEditor(RoutineDefinition routine, HairAppBl.Interfaces.IHairBl hairBl) : this()
 {
     mRoutine = routine;
     mHairbl  = hairBl;
     RefreshList();
     OKButton.Clicked += OKButton_Clicked;
 }
예제 #5
0
 public static ImageButton GetButton(string image, HairAppBl.Interfaces.IHairBl hairbl)
 {
     return(new ImageButton
     {
         Style = (Style)hairbl.Resources["RoutineButton"],
         HorizontalOptions = LayoutOptions.EndAndExpand,
         Source = image
     });
 }
예제 #6
0
        public AddRoutineDialog(WashingDayEditorController controller, HairAppBl.Interfaces.IHairBl hairbl) : this()
        {
            this.mWashingDayEditorController = controller;
            mHairbl = hairbl;

            RefreshList();
            AddButton.Clicked          += AddButton_Clicked;
            openSettingsButton.Clicked += OpenSettingsButton_Clicked;
        }
예제 #7
0
        public WashDayInstance(WashingDayDefinition definition, WashingDayInstance instance, HairAppBl.Interfaces.IHairBl hairbl)
        {
            InitializeComponent();

            mInstance   = instance;
            mDefinition = definition;
            mHairbl     = hairbl;

            InitFields();
        }
예제 #8
0
        public PicturePage(ImageSource source, HairAppBl.Interfaces.IHairBl hairbl)
        {
            InitializeComponent();

            var navi = new Controls.NavigationControl("Home", "", hairbl);

            NavigationContainer.Content = navi.View;
            navi.LeftButton.Clicked    += LeftButton_Clicked;;

            mImageView.Source = source;
        }
예제 #9
0
        public HistoryPage(HairAppBl.Interfaces.IHairBl hairbl, MainSessionController controller)
        {
            InitializeComponent();

            mMainSessionController = controller;
            mHairBl = hairbl;

            mMainSessionController.InstanceEdited += MMainSessionController_InstanceEdited;

            RefreshList();

            //Resources
            mFinishedCareDaysLabel.Text = AppResources.FinishedCareDays;
        }
예제 #10
0
        public ChoosePictureDialog(HairAppBl.Interfaces.IHairBl hairbl)
        {
            InitializeComponent();
            mHairbl = hairbl;
            TakePictureButton.Clicked   += TakePictureButton_Clicked;
            SelectPictureButton.Clicked += SelectPictureButton_Clicked;

            SelectPicContainer.Scale = 0;
            SelectPicContainer.ScaleTo(1, 500);
            TakePicContainer.Scale = 0;
            TakePicContainer.ScaleTo(1, 500);

            //Resources
            mTakeNewPicLabel.Text      = AppResources.TakePic;
            mSelectFromAlbumLabel.Text = AppResources.SelectFromAlbum;
        }
예제 #11
0
        public WashDayEditor(MainSessionController mainSession, WashingDayEditorController wdController, Boolean create, HairAppBl.Interfaces.IHairBl hairbl)
        {
            InitializeComponent();

            mHairbl = hairbl;
            mCreate = create;
            mWashingDayEditorController = wdController;
            mMainSessionController      = mainSession;

            RefreshList();

            var saveClose = new NavigationControl(AppResources.Cancel, AppResources.Save, hairbl);

            SaveButtonContainer.Content = saveClose.View;

            //Events
            this.AddRoutine.Clicked       += AddRoutine_Clicked;
            saveClose.RightButton.Clicked += OKButton_Clicked;
            saveClose.LeftButton.Clicked  += CancelButton_Clicked;

            var colorButtonClicked = new TapGestureRecognizer();

            colorButtonClicked.Tapped += ColorClicked_Tapped;
            colorButton.GestureRecognizers.Add(colorButtonClicked);

            InitFields();

            //Resources
            mDefineYourCareDayLabel.Text = AppResources.DefineYourCareDay;
            AddRoutine.Text               = AppResources.AddRoutine;
            mScheduleLabel.Text           = AppResources.Schedule;
            mWeekSelectionEveryLabel.Text = AppResources.Every;
            mWeekSelectionEveryWeek.Text  = AppResources.Weeks;
            mDaysSelectionEveryLabel.Text = AppResources.Every;
            mDaysSelectionDaysLabel.Text  = AppResources.Days;
            mStartDateLabel.Text          = AppResources.StartDate;
            mRoutinesLabel.Text           = AppResources.Routines;
            AddDescription.Text           = AppResources.AddDescription;

            mCheckBoxMonday.DefaultText    = AppResources.Monday;
            mCheckBoxTuesday.DefaultText   = AppResources.Tuesdays;
            mCheckBoxWednesday.DefaultText = AppResources.Wednesday;
            mCheckBoxThursday.DefaultText  = AppResources.Thursday;
            mCheckBoxFriday.DefaultText    = AppResources.Friday;
            mCheckBoxSaturday.DefaultText  = AppResources.Saturday;
            mCheckBoxSunday.DefaultText    = AppResources.Sunday;
        }
예제 #12
0
        public CareDayList(MainSessionController mainSessionController, HairAppBl.Interfaces.IHairBl hairbl, AlarmController ac, ContentPage page)
        {
            mMainSessionController = mainSessionController;
            mWashingDays           = mainSessionController.GetAllWashingDays();
            mHairbl          = hairbl;
            mAlarmController = ac;
            mPage            = page;

            mMainSessionController.DefinitionsEdited += MMainSessionController_DefinitionsEdited;

            mWashDayList = new StackLayout {
                Orientation = StackOrientation.Vertical, HorizontalOptions = LayoutOptions.FillAndExpand
            };

            Children.Add(mWashDayList);
            RefreshList();
        }
예제 #13
0
        public HairLengthControl(HairAppBl.Interfaces.IHairBl hairbl, HairLength hl = null) : this()
        {
            if (hl != null)
            {
                mHairLength = hl;
            }

            mHairbl          = hairbl;
            mDatePicker      = new DatePicker();
            mDatePicker.Date = ScheduleController.GetToday();
            mBackEntry       = GetEntry();
            mSideEntry       = GetEntry();
            mFrontEntry      = GetEntry();
            var takePhoto = new Button {
                Text = AppResources.TakePic
            };

            takePhoto.Clicked += TakePhoto_Clicked;

            mPicture = new Image {
                HeightRequest = 100, IsVisible = false
            };

            if (hl != null)
            {
                mBackEntry.Text  = hl.Back.ToString();
                mSideEntry.Text  = hl.Side.ToString();
                mFrontEntry.Text = hl.Front.ToString();
                if (!string.IsNullOrEmpty(hl.Picture))
                {
                    mPicture.Source    = hl.Picture;
                    mCurrentPhoto      = hl.Picture;
                    mPicture.IsVisible = true;
                }
                mDatePicker.Date = hl.Day;
            }


            Children.Add(mDatePicker);
            Children.Add(GetRow(mBackEntry, AppResources.BackLenght));
            Children.Add(GetRow(mSideEntry, AppResources.SideLenght));
            Children.Add(GetRow(mFrontEntry, AppResources.FrontLength));
            Children.Add(mPicture);
            Children.Add(takePhoto);
        }
예제 #14
0
        public AddHairLengthDialog(HairAppBl.Interfaces.IHairBl hairbl, HairAppBl.Models.HairLength hl = null)
        {
            InitializeComponent();
            mHairbl          = hairbl;
            AddNewHairLength = hl == null;

            mHairLengthControl          = new Controls.HairLengthControl(hairbl, hl);
            hairLengthContainer.Content = mHairLengthControl;
            mHairLengthControl.TakeOrPicPhotoClicked += Hlc_TakeOrPicPhotoClicked;

            OKButton.Clicked     += OKButton_Clicked;
            CancelButton.Clicked += CancelButton_Clicked;

            //Resources
            mEnterHairLengthLabel.Text = AppResources.EnterYourHairLength;
            CancelButton.Text          = AppResources.Cancel;
            OKButton.Text = AppResources.Save;
        }
예제 #15
0
        public ChartPage(HairAppBl.Interfaces.IHairBl hairbl, MainSessionController controller)
        {
            InitializeComponent();

            mMainSessionController = controller;
            mHairBl      = hairbl;
            mHairLengths = mMainSessionController.GetHairLength();

            mMainSessionController.InstanceEdited += MMainSessionController_InstanceEdited;

            mAddHairLengthButton.Clicked += AddHairLengthButton_Clicked;

            //Resources
            mAddHairLengthButton.Text      = AppResources.AddHairLength;
            mHairLengthStatisticLabel.Text = AppResources.HairlengthStatistic;

            RefreshList();
        }
예제 #16
0
        public CalendarPage(MainSessionController controller, AlarmController ac, HairAppBl.Interfaces.IHairBl hairbl)
        {
            InitializeComponent();

            mMainSessionController = controller;
            mAlarmController       = ac;
            mHairBl = hairbl;

            //Calendar
            InitCalendar();

            //Resources
            mPlanedCareDaysLabel.Text  = AppResources.PlanedCareDays;
            mFinshedCareDaysLabel.Text = AppResources.FinishedCareDays;

            mMainSessionController.DefinitionsEdited += MMainSessionController_DefinitionsEdited;
            mMainSessionController.InstanceEdited    += MMainSessionController_InstanceEdited;
        }
예제 #17
0
        public RoutineEditor(MainSessionController mainSession, HairAppBl.Interfaces.IHairBl hairbl, HairAppBl.Models.RoutineDefinition select = null)
        {
            InitializeComponent();


            mHairbl = hairbl;

            var saveClose = new NavigationControl(AppResources.Cancel, AppResources.Save, hairbl);

            SaveButtonContainer.Content = saveClose.View;

            saveClose.RightButton.Clicked += OKButton_Clicked;
            saveClose.LeftButton.Clicked  += CancelButton_Clicked;
            mAddRoutineButton.Clicked     += MAddRoutineButton_Clicked;
            RefreshList(select);

            //Ressources
            mHeading.Text = AppResources.RoutinEditorHeading;
        }
예제 #18
0
        public static StackLayout GetCalendarDetailsRow(string icon, View content, HairAppBl.Interfaces.IHairBl hairbl)
        {
            var row = new StackLayout {
                Orientation = StackOrientation.Horizontal
            };

            row.Children.Add(new Image {
                Source = icon, Style = (Style)hairbl.Resources["CalendarDetailsImage"],
            });

            var frame = new Frame
            {
                Style   = (Style)hairbl.Resources["CalendarDetailsFrame"],
                Content = content
            };

            row.Children.Add(frame);

            return(row);
        }
예제 #19
0
        public MainNavigationControl(HairAppBl.Interfaces.IHairBl hairbl)
        {
            var grid = new Grid();

            grid.HorizontalOptions = LayoutOptions.FillAndExpand;

            grid.RowDefinitions.Add(new RowDefinition {
                Height = 50
            });
            grid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });
            grid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });
            grid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });

            LeftButton = new ImageButton {
                Source = "home.png",
                Style  = (Style)hairbl.Resources["HomeButton"]
            };
            MiddleButton = new ImageButton {
                Source = "calendar.png",
                Style  = (Style)hairbl.Resources["HomeButton"]
            };
            RightButton = new ImageButton {
                Source = "chart.png",
                Style  = (Style)hairbl.Resources["HomeButton"]
            };

            grid.Children.Add(LeftButton, 0, 0);
            grid.Children.Add(MiddleButton, 1, 0);
            grid.Children.Add(RightButton, 2, 0);
            View = new Frame {
                Content = grid
            };
        }
예제 #20
0
        public MainPage(AlarmController ac, HairAppBl.Interfaces.IHairBl hairbl)
        {
            App.BL.Logger.Call("MainPage");
            InitializeComponent();

            this.mAlarmController = ac;
            mHairBl = hairbl;

            mCareDayList             = new CareDayList(App.MainSession, App.BL, mAlarmController, this);
            CareDayListFrame.Content = mCareDayList;

            mAddCareDayButton.Clicked += MAddCareDayButton_Clicked;

            var openLog = new TapGestureRecognizer();

            openLog.NumberOfTapsRequired = 2;
            openLog.Tapped += (s, e) => {
                Navigation.PushAsync(new LogView(App.BL.Logger));
            };
            ValsImage.GestureRecognizers.Add(openLog);

            //Resources
            mListOfAllCareDaysLabel.Text = AppResources.ListOfAllCareDays;
        }
예제 #21
0
        public RoutineInstanceCell(RoutineInstance instance, HairAppBl.Interfaces.IHairBl hairbl)
        {
            mRoutine = instance;
            mHairBl  = hairbl;

            mCheckBox = new XLabs.Forms.Controls.CheckBox();
            mCheckBox.CheckedChanged += MCheckBox_CheckedChanged;
            mCheckBox.Checked         = instance.Checked;

            var tapGestureRecognizer = new TapGestureRecognizer();

            tapGestureRecognizer.Tapped += (s, e) => {
                ShowMore();
            };

            var commentButton = Common.GetButton("comment.png", hairbl);

            commentButton.Clicked += (sender, e) =>
            {
                mDetailsFrame.IsVisible = !mDetailsFrame.IsVisible;
            };

            var nameLabel = new Label
            {
                Text           = instance.Name,
                FontSize       = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
                FontAttributes = FontAttributes.Bold
            };

            var descriptionLabel = new Label
            {
                Text           = instance.Description,
                FontSize       = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
                FontAttributes = FontAttributes.Bold,
                IsVisible      = !String.IsNullOrWhiteSpace(instance.Description)
            };


            mComment = new Editor
            {
                HeightRequest = 120,
                Placeholder   = AppResources.AddComment,
                Text          = mRoutine.Comment
            };
            mComment.TextChanged += MComment_TextChanged;

            mDetailsFrame = new StackLayout
            {
                Orientation = StackOrientation.Vertical,
                Style       = (Style)hairbl.Resources["DetailsFrame"],
                IsVisible   = false,
                Children    = { descriptionLabel, mComment }
            };

            var frame = new Frame
            {
                Style   = (Style)hairbl.Resources["RoutineFrame"],
                Content = new StackLayout
                {
                    Orientation = StackOrientation.Vertical,
                    Children    =
                    {
                        new StackLayout
                        {
                            Style       = (Style)hairbl.Resources["RoutineContent"],
                            Orientation = StackOrientation.Horizontal,

                            Children ={ mCheckBox,                nameLabel, commentButton }
                        },
                        mDetailsFrame
                    }
                }
            };

            frame.GestureRecognizers.Add(tapGestureRecognizer);
            View = frame;
        }
예제 #22
0
        public DetailsControl(HairAppBl.Interfaces.IHairBl hairbl)
        {
            this.mHairBl = hairbl;

            //Header
            mColorFrame = new Frame
            {
                CornerRadius  = 4,
                Padding       = new Thickness(0, 0, 0, 0),
                HeightRequest = 10,
                WidthRequest  = 15
            };

            mLabelText = new Label
            {
                FontSize       = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
                FontAttributes = FontAttributes.Bold
            };
            mHeaderLeft = new ContentView
            {
                HorizontalOptions = LayoutOptions.Start
            };
            mHeaderRight = new ContentView
            {
                HorizontalOptions = LayoutOptions.EndAndExpand
            };

            mDetailsFrame = new StackLayout
            {
                Orientation = StackOrientation.Vertical,
                Style       = (Style)hairbl.Resources["DetailsFrame"],
                IsVisible   = false,
                Opacity     = 0
            };


            var frame = new Frame
            {
                Style   = (Style)hairbl.Resources["RoutineFrame"],
                Content = new StackLayout
                {
                    Orientation = StackOrientation.Vertical,
                    Children    =
                    {
                        new StackLayout
                        {
                            Style       = (Style)hairbl.Resources["RoutineContent"],
                            Orientation = StackOrientation.Horizontal,
                            Children    = { mColorFrame, mLabelText, mHeaderLeft, mHeaderRight }
                        },
                        mDetailsFrame
                    }
                }
            };
            var tapGestureRecognizer = new TapGestureRecognizer();

            tapGestureRecognizer.Tapped += (s, e) => {
                if (!mDetailsFrame.IsVisible)
                {
                    ShowDetailsAnimation();
                }
                else
                {
                    HideDetailsAnimation();
                }
            };
            frame.GestureRecognizers.Add(tapGestureRecognizer);

            View = frame;
        }
        public WashingDayInstanceCalendarCell(WashingDayInstance instance, WashingDayDefinition def, HairAppBl.Interfaces.IHairBl hairbl) : base(hairbl)
        {
            this.Instance   = instance;
            this.Definition = def;
            this.HeaderName = Definition.Name;
            Color           = Definition.ItemColor;

            var commentLabel = Common.GetCalendarDetailsRow("comment.png", new Label
            {
                Text     = instance.Comment,
                FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
            }, hairbl);

            commentLabel.IsVisible = !String.IsNullOrWhiteSpace(instance.Comment);

            var picContainer = new ScrollView {
                Orientation = ScrollOrientation.Horizontal
            };
            var picListView = new StackLayout {
                Orientation = StackOrientation.Horizontal
            };

            picContainer.Content = picListView;

            foreach (var pic in instance.Pictures)
            {
                var img = new ImageButton {
                    HeightRequest = 60, Source = ImageSource.FromFile(pic.Path), BackgroundColor = Color.Transparent
                };
                img.Clicked += Img_Clicked;
                picListView.Children.Add(img);
            }

            var pictureList = Common.GetCalendarDetailsRow("camera.png", picContainer, hairbl);

            pictureList.IsVisible = instance.Pictures.Count > 0;

            var showMore = new Button
            {
                Text            = Resources.AppResources.ShowMore,
                BackgroundColor = Color.Transparent,
                TextColor       = Color.Blue
            };

            showMore.Clicked += ShowMoreButton_Clicked;

            var routineList = new StackLayout
            {
                Orientation = StackOrientation.Vertical,
            };

            foreach (var r in instance.Routines)
            {
                var check = new XLabs.Forms.Controls.CheckBox();
                check.Checked   = r.Checked;
                check.IsEnabled = false;
                var row = new StackLayout {
                    Orientation = StackOrientation.Horizontal
                };
                row.Children.Add(check);
                row.Children.Add(new Label {
                    Text = r.Name
                });
                routineList.Children.Add(row);
            }

            var routineFrame = Common.GetCalendarDetailsRow("list.png", routineList, hairbl);
            var neededTime   = Common.GetCalendarDetailsRow("time.png", new Label {
                Text = $"{instance.NeededTime.TotalMinutes} {HairApp.Resources.AppResources.Minutes}"
            }, hairbl);

            DetailsContent.Add(commentLabel);
            DetailsContent.Add(routineFrame);
            DetailsContent.Add(neededTime);
            DetailsContent.Add(pictureList);
            DetailsContent.Add(showMore);
        }
        public WashingDayDefinitionControl(WashingDayEditorController controller, HairAppBl.Interfaces.IHairBl hairbl) : base(hairbl)
        {
            this.WdController = controller;
            var def = WdController.GetModel();

            HeaderName = def.Name;
            Color      = def.ItemColor;

            var descriptionLabel = Common.GetCalendarDetailsRow("description.png", new Label
            {
                Text      = def.Description,
                FontSize  = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
                IsVisible = !String.IsNullOrWhiteSpace(def.Description)
            }, hairbl);

            descriptionLabel.IsVisible = !String.IsNullOrWhiteSpace(def.Description);

            var scheduleLabel = Common.GetCalendarDetailsRow("schedule.png", new Label
            {
                Text     = WdController.GetSchedule(),
                FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
            }, hairbl);


            var editLabel = new Label
            {
                Text  = AppResources.Edit,
                Style = (Style)hairbl.Resources["DetailsActionLabel"]
            };

            var editControl = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                Children    =
                {
                    new Image
                    {
                        Source = "edit.png",
                        Style  = (Style)hairbl.Resources["DetailsActionImage"]
                    },
                    editLabel
                }
            };
            var editClicked = new TapGestureRecognizer();

            editClicked.Tapped += EditButton_Clicked;

            editControl.GestureRecognizers.Add(editClicked);

            var deleteLabel = new Label
            {
                Text  = AppResources.Remove,
                Style = (Style)hairbl.Resources["DetailsActionLabel"]
            };

            var deleteControl = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                Children    =
                {
                    new Image
                    {
                        Source = "remove.png",
                        Style  = (Style)hairbl.Resources["DetailsActionImage"]
                    },
                    deleteLabel
                }
            };
            var deleteClicked = new TapGestureRecognizer();

            deleteClicked.Tapped += DeleteButton_Clicked;

            deleteControl.GestureRecognizers.Add(deleteClicked);

            var routineList = new StackLayout
            {
                Orientation = StackOrientation.Vertical,
            };

            var listContainer = Common.GetCalendarDetailsRow("list.png", routineList, hairbl);

            foreach (var r in def.Routines)
            {
                routineList.Children.Add(new Label {
                    Text = WdController.GetRoutineById(r).Name
                });
            }

            DetailsContent.Add(descriptionLabel);
            DetailsContent.Add(scheduleLabel);
            DetailsContent.Add(listContainer);
            DetailsContent.Add(new StackLayout
            {
                Orientation       = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.Center,
                Spacing           = 30,
                Children          =
                {
                    editControl, deleteControl
                }
            });
        }
        public WashingDayDefinitionHomeControl(WashingDayEditorController controller, HairAppBl.Interfaces.IHairBl hairbl) : base(controller, hairbl)
        {
            var c = new ScheduleController(controller.GetModel().Scheduled);
            var t = c.Time2NextCareDay(ScheduleController.GetToday());

            //StartCareDay
            var startImage = new Image {
                Source = "start.png", HeightRequest = 22
            };

            var startCareDayTab = new TapGestureRecognizer();

            startCareDayTab.Tapped += (s, e) => {
                StartCareDay?.Invoke(this, new WashingDayCellEventArgs(controller));
            };
            startImage.GestureRecognizers.Add(startCareDayTab);

            if (t == 0)
            {
                HeaderExtensionRight = startImage;
            }

            var text = AppResources.Today;

            if (t > 0)
            {
                text = AppResources.InDays.Replace("{count}", t.ToString());
            }
            HeaderExtensionLeft = new Label
            {
                Text = text
            };
        }
예제 #26
0
        public RoutineDefinitionCell(RoutineDefinition routine, HairAppBl.Interfaces.IHairBl hairbl, int number)
        {
            this.mHairBl = hairbl;
            this.Routine = routine;
            text         = new Label
            {
                Text           = $"{number}) {Routine.Name}",
                FontSize       = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
                FontAttributes = FontAttributes.Bold
            };

            var tapGestureRecognizer = new TapGestureRecognizer();

            tapGestureRecognizer.Tapped += (s, e) => {
                Select();
            };


            editButton          = Common.GetButton("edit.png", hairbl);
            editButton.Clicked += (sender, e) =>
            {
                SendEdit();
            };

            deleteButton          = Common.GetButton("remove.png", hairbl);
            deleteButton.Clicked += (sender, e) =>
            {
                SendRemoved();
            };

            downButton          = Common.GetButton("down.png", hairbl);
            downButton.Clicked += (sender, e) =>
            {
                SendMoveDown();
            };

            upButton          = Common.GetButton("up.png", hairbl);
            upButton.Clicked += (sender, e) =>
            {
                SendMoveUp();
            };

            buttonGroup = new StackLayout
            {
                Orientation       = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.EndAndExpand,
                IsVisible         = false,
                Children          = { downButton, upButton, editButton, deleteButton }
            };

            var frame = new Frame
            {
                Style   = (Style)hairbl.Resources["RoutineFrame"],
                Content = new StackLayout
                {
                    Style       = (Style)hairbl.Resources["RoutineContent"],
                    Orientation = StackOrientation.Horizontal,

                    Children =
                    {
                        new StackLayout {
                            Orientation = StackOrientation.Vertical,
                            Children    = { text }
                        },
                        buttonGroup
                    }
                }
            };

            frame.GestureRecognizers.Add(tapGestureRecognizer);
            View = frame;
        }
예제 #27
0
        public HairChartView(HairAppBl.Interfaces.IHairBl hairbl, HairChartController controller)
        {
            mModel                     = new PlotModel();
            mController                = controller;
            mPictContainer             = new StackLayout();
            mPictContainer.Orientation = StackOrientation.Horizontal;

            mEditButton          = Common.GetButton("edit.png", hairbl);
            mEditButton.Clicked += (sender, e) =>
            {
                Edited?.Invoke(this, new EditEventArgs(mCurrentHairLength));
            };

            var allPoints = new List <DataPoint>();

            foreach (var l in mController.GetCharts())
            {
                allPoints.AddRange(l.Points);
            }

            if (allPoints.Any())
            {
                //Y Axis
                var maxY = allPoints.Max(p => p.Y) + 5;
                var minY = allPoints.Min(p => p.Y) - 5;

                var yAxis = new LinearAxis()
                {
                    Position = AxisPosition.Right, Minimum = minY, Maximum = maxY, StringFormat = "00cm"
                };

                //X Axis
                var minX  = allPoints.Min(p => p.X) - 3;
                var maxX  = allPoints.Max(p => p.X) + 3;
                var xAxis = new DateTimeAxis()
                {
                    Position = AxisPosition.Bottom, Minimum = minX, Maximum = maxX, StringFormat = "dd.MM.yy"
                };

                mModel.Axes.Add(yAxis);
                mModel.Axes.Add(xAxis);
            }

            foreach (var l in mController.GetCharts())
            {
                var ls = new LineSeries();
                ls.TrackerFormatString   = "{4}cm";
                ls.MarkerType            = MarkerType.Circle;
                ls.MarkerStrokeThickness = 3;
                ls.TouchStarted         += Ls_TouchStarted;
                ls.Title           = l.Name;
                ls.SelectionMode   = OxyPlot.SelectionMode.Single;
                ls.StrokeThickness = 4;
                ls.Points.AddRange(l.Points);
                ls.Color = l.Color;

                mModel.Series.Add(ls);
            }
            mModel.IsLegendVisible = false;

            var lengths = mController.GetLengths().OrderBy(x => x.Day);

            foreach (var hl in lengths)
            {
                var image = new HairLengthImage(hairbl, hl)
                {
                    Source = hl.Picture,
                };
                image.Clicked += Image_Clicked;
                mPictContainer.Children.Add(image);
            }

            mScrollContainer = new ScrollView
            {
                Orientation   = ScrollOrientation.Horizontal,
                Content       = mPictContainer,
                HeightRequest = 100,
            };

            if (lengths.Any())
            {
                FillData(lengths.Last());
                SelectImage((HairLengthImage)mPictContainer.Children.Last());
                SelectAllPoints(lengths.Last());
            }


            Padding         = new Thickness(0, 0, 0, 0);
            VerticalOptions = LayoutOptions.FillAndExpand;
            BackgroundColor = Color.Transparent;
            this.Content    = new StackLayout
            {
                BackgroundColor = Color.Transparent,
                VerticalOptions = LayoutOptions.FillAndExpand,
                Children        =
                {
                    new Frame
                    {
                        VerticalOptions = LayoutOptions.FillAndExpand,
                        CornerRadius    = 4,
                        Content         = new StackLayout
                        {
                            VerticalOptions = LayoutOptions.FillAndExpand,
                            Children        =
                            {
                                new PlotView
                                {
                                    Model             = mModel,
                                    VerticalOptions   = LayoutOptions.FillAndExpand,
                                    HorizontalOptions = LayoutOptions.Fill,
                                },
                                mScrollContainer
                            }
                        }
                    },
                    new Frame
                    {
                        CornerRadius = 4,
                        Content      = GetDataFields()
                    }
                }
            };
        }
예제 #28
0
        public RoutineDefinitionEditCell(RoutineDefinition routine, HairAppBl.Interfaces.IHairBl hairbl)
        {
            this.mHairBl = hairbl;
            this.Routine = routine;
            var labelTitle = new Label
            {
                Text = Resources.AppResources.Title
            };

            var labelDescription = new Label
            {
                Text = Resources.AppResources.Description
            };

            title = new Entry
            {
                Text           = Routine.Name,
                FontSize       = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
                FontAttributes = FontAttributes.Bold
            };
            description = new Entry
            {
                Text           = Routine.Description,
                FontSize       = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
                FontAttributes = FontAttributes.Bold
            };


            deleteButton          = Common.GetButton("remove.png", hairbl);
            deleteButton.Clicked += (sender, e) =>
            {
                SendRemoved();
            };

            buttonGroup = new StackLayout
            {
                Orientation       = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.EndAndExpand,
                IsVisible         = false,
                Children          = { deleteButton }
            };

            var frame = new Frame
            {
                Style   = (Style)hairbl.Resources["RoutineFrame"],
                Content = new StackLayout
                {
                    Style       = (Style)hairbl.Resources["RoutineContent"],
                    Orientation = StackOrientation.Vertical,

                    Children =
                    {
                        labelTitle,
                        new StackLayout {
                            Orientation = StackOrientation.Horizontal,
                            Children    = { title, buttonGroup       }
                        },
                        labelDescription,
                        description
                    }
                }
            };
            var editClicked = new TapGestureRecognizer();

            editClicked.Tapped += EditClicked_Tapped;;

            frame.GestureRecognizers.Add(editClicked);
            View = frame;
        }