private async void GetReplys(bool isRefresh)
        {
            TitleBar.ShowProgressRing();
            int page  = isRefresh ? 1 : ++this.page;
            var array = (JArray)await DataHelper.GetDataAsync(DataUriType.GetReplyReplies, id, page, page > 1?$"&lastItem={lastItem}" : string.Empty);

            if (array != null && array.Count > 0)
            {
                if (isRefresh)
                {
                    VScrollViewer?.ChangeView(null, 0, null);
                    var d = (from a in replys
                             from b in array
                             where a.Id == b.Value <int>("id")
                             select a).ToArray();
                    foreach (var item in d)
                    {
                        replys.Remove(item);
                    }
                    for (int i = 0; i < array.Count; i++)
                    {
                        replys.Insert(i + 1, new FeedReplyModel((JObject)array[i]));
                    }
                }
                else
                {
                    foreach (JObject item in array)
                    {
                        replys.Add(new FeedReplyModel(item, false));
                    }
                    lastItem = array.Last.Value <int>("id");
                }
            }
            else if (!isRefresh)
            {
                this.page--;
            }
            TitleBar.HideProgressRing();
        }
Exemplo n.º 2
0
        private void UpdateLoadingStates()
        {
            TitleBar.TryUpdateMetrics();

            if (ViewModel.IsLoadingFonts && !ViewModel.IsLoadingFontsFailed)
            {
                VisualStateManager.GoToState(this, nameof(FontsLoadingState), true);
            }
            else if (ViewModel.IsLoadingFontsFailed)
            {
                VisualStateManager.GoToState(this, nameof(FontsFailedState), true);
            }
            else
            {
                VisualStateManager.GoToState(this, nameof(FontsLoadedState), false);
                if (ViewModel.Settings.UseSelectionAnimations)
                {
                    CompositionFactory.StartStartUpAnimation(
                        new List <FrameworkElement>
                    {
                        OpenFontPaneButton,
                        FontListFilter,
                        OpenFontButton,
                        FontMap.FontTitleBlock,
                        FontMap.SearchBox,
                        BtnSettings
                    },
                        new List <UIElement>
                    {
                        FontListSearchBox,
                        FontsSemanticZoom,
                        FontMap.CharGridHeader,
                        FontMap.SplitterContainer,
                        FontMap.CharGrid,
                        FontMap.PreviewGrid
                    });
                }
            }
        }
Exemplo n.º 3
0
        public ThirdPage()
        {
            var titleBarTop = new TitleBar(this, TitleBar.BarBtnEnum.bbBack, TitleBar.BarAlignEnum.baTop);

            titleBarTop.BarColor = Color.Gray;
            titleBarTop.Title    = "THIRD";

            titleBarTop.BtnBack.BackgroundColor = Color.Transparent;
            titleBarTop.BtnBack.Source          = Device.OnPlatform("Icon/back.png", "ic_back.png", "Assets/Icon/back.png");

            var titleBarBottom = new TitleBar(this, TitleBar.BarBtnEnum.bbLeftRight, TitleBar.BarAlignEnum.baBottom);

            titleBarBottom.BarColor = Color.Transparent;

            titleBarBottom.BtnLeft.BackgroundColor = Color.Gray;
            titleBarBottom.BtnLeft.Source          = Device.OnPlatform("Icon/4.png", "ic_4.png", "Assets/Icon/4.png");
            titleBarBottom.BtnLeft.Click          += (s, e) => { this.Navigation.PushAsync(new FourthPage()); };

            titleBarBottom.BtnRight.BackgroundColor = Color.Gray;
            titleBarBottom.BtnRight.Source          = Device.OnPlatform("Icon/5.png", "ic_5.png", "Assets/Icon/5.png");
            titleBarBottom.BtnRight.Click          += (s, e) => { this.Navigation.PushAsync(new FifthPage()); };

            var relativeLayout = new RelativeLayout
            {
                BackgroundColor = Color.Blue,
            };

            relativeLayout.Children.Add(titleBarTop,
                                        Constraint.Constant(0),
                                        Constraint.Constant(0),
                                        Constraint.RelativeToParent(parent => { return(parent.Width); }));

            relativeLayout.Children.Add(titleBarBottom,
                                        Constraint.Constant(0),
                                        Constraint.RelativeToParent(parent => { return(parent.Height - titleBarBottom.HeightBar); }),
                                        Constraint.RelativeToParent(parent => { return(parent.Width); }));

            Content = relativeLayout;
        }
Exemplo n.º 4
0
        private void MultipleCubes()
        {
            TitleBar titleBar = new TitleBar(this.GetType().Name);

            FreeArea area = new FreeArea();

            area.SetMargin(0, titleBar.GetHeight(), 0, 0);

            AddItems(titleBar, area);

            List <IBaseItem> content = new List <IBaseItem>();

            for (int row = 0; row < 3; row++)
            {
                for (int column = 0; column < 3; column++)
                {
                    ResizableItem frame = new ResizableItem();
                    frame.SetBorder(new Border(Color.Gray, new CornerRadius(), 2));
                    frame.SetPadding(5, 5, 5, 5);
                    frame.SetBackground(100, 100, 100);
                    frame.SetSize(200, 200);
                    frame.SetPosition(90 + row * 210, 60 + column * 210);
                    area.AddItem(frame);
                    content.Add(frame);

                    frame.EventMousePress += (sender, args) =>
                    {
                        content.Remove(frame);
                        content.Add(frame);
                        area.SetContent(content);
                    };

                    OpenGLLayer ogl = new OpenGLLayer();
                    ogl.SetMargin(0, 30, 0, 0);
                    frame.AddItem(ogl);
                }
            }
        }
Exemplo n.º 5
0
        public override void InitWindow()
        {
            SetParameters(nameof(CharacterEditor), nameof(CharacterEditor), 1000, 600, false);
            IsCentered = true;

            //title
            TitleBar title = new TitleBar(nameof(CharacterEditor));

            title.SetIcon(
                DefaultsService.GetDefaultImage(EmbeddedImage.User, EmbeddedImageSize.Size32x32), 20, 20);

            //layout
            VerticalStack layout = ItemFactory.GetStandardLayout(title.GetHeight());

            //////////////////////////////////////////////////////////////////////////////
            HorizontalStack   toolbar   = ItemFactory.GetToolbar();
            VerticalSplitArea splitArea = ItemFactory.GetSplitArea();

            BtnGenerate = ItemFactory.GetToolbarButton();
            BtnSave     = ItemFactory.GetToolbarButton();
            NumberCount = ItemFactory.GetSpinItem();
            ItemText.SetStyle(StyleFactory.GetTextAreaStyle());
            //////////////////////////////////////////////////////////////////////////////

            //adding
            AddItems(title, layout);
            layout.AddItems(toolbar, splitArea);
            splitArea.AssignLeftItem(ItemList);
            splitArea.AssignRightItem(ItemText);
            toolbar.AddItems(BtnGenerate, BtnSave, ItemFactory.GetVerticalDivider(), NumberCount);
            BtnGenerate.AddItem(ItemFactory.GetToolbarIcon(
                                    DefaultsService.GetDefaultImage(EmbeddedImage.Refresh, EmbeddedImageSize.Size32x32)
                                    ));
            BtnSave.AddItem(ItemFactory.GetToolbarIcon(
                                DefaultsService.GetDefaultImage(EmbeddedImage.Diskette, EmbeddedImageSize.Size32x32)
                                ));
        }
Exemplo n.º 6
0
        private void Form1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            bool OverClose, OverMin;

            OverClose = CloseButton.IsVisible(e.X, e.Y);
            OverMin   = MinButton.IsVisible(e.X, e.Y);

            if (OverClose && ClosePress && e.Button == MouseButtons.Left)
            {
                this.Close();
            }
            if (OverMin && MinPress && e.Button == MouseButtons.Left)
            {
                this.WindowState = FormWindowState.Minimized;
            }

            if (e.Button == MouseButtons.Right && TitleBar.IsVisible(e.X, e.Y))
            {
                if (OverClose == false && OverMin == false)
                {
                    const int WM_GETSYSMENU = 0x313;
                    if (e.Button == MouseButtons.Right)
                    {
                        Point   pos  = this.PointToScreen(new Point(e.X, e.Y));
                        IntPtr  hPos = (IntPtr)((int)((pos.Y * 0x10000) | (pos.X & 0xFFFF)));
                        Message msg  = Message.Create(this.Handle, WM_GETSYSMENU, IntPtr.Zero, hPos);
                        WndProc(ref msg);
                    }
                }
            }

            ClosePress = false;
            MinPress   = false;
            FormDrag   = false;

            Invalidate();
        }
Exemplo n.º 7
0
        public override void InitWindow()
        {
            SetParameters("Mainwindow", "RadialMenu Example C#", 800, 600, false);
            SetMinSize(300, 300);
            SetBackground(StyleFactory.CommonBackground);
            SetPadding(0, 0, 0, 0);
            SetAntiAliasingQuality(MSAA.MSAA8x);
            IsCentered = true;

            // title
            TitleBar title = new TitleBar(GetWindowTitle());

            // radial menu
            RadialMenu = new RadialMenuItem(this);

            // contact menu
            Menu = new ContactMenu(this, RadialMenu);

            ShowContactsBtn = new ButtonCore("Show");
            ShowContactsBtn.SetStyle(StyleFactory.GetRoundedButtonStyle());

            // adding
            AddItems(title, ShowContactsBtn);
        }
Exemplo n.º 8
0
        void UpdateAppTitle()
        {
            Thickness currMargin = AppTitleBar.Margin;

            AppTitleBar.Margin = new Thickness(currMargin.Left, currMargin.Top, TitleBar.GetSystemOverlayRightInset(this), currMargin.Bottom);
        }
Exemplo n.º 9
0
        public AboutPage()
            : base(typeof(AboutViewModel), typeof(AboutContentUI))
        {
            BackgroundColor         = MainStyles.StatusBarColor.FromResources <Color>();
            Content.BackgroundColor = MainStyles.MainBackgroundColor.FromResources <Color>();

            var loadingColor = MainStyles.LoadingColor.FromResources <Color>();

            LoadingActivityIndicator.Color = loadingColor;
            LoadingActivityText.TextColor  = loadingColor;

            var appBar = new TitleBar(this, TitleBar.BarBtnEnum.bbBack)
            {
                BarColor   = MainStyles.StatusBarColor.FromResources <Color>(),
                TitleStyle = LabelStyles.PageTitleStyle.FromResources <Style>(),
                BtnBack    =
                {
                    Source = contentUI.IconBack
                }
            };

            appBar.SetBinding(TitleBar.TitleProperty, "Title");

            var imgLogo = new Image
            {
                Source = contentUI.ImgLogo
            };

            var txtTitle = new Label
            {
                Text  = contentUI.TxtTitle,
                Style = LabelStyles.TitleLightStyle.FromResources <Style>()
            };

            #region Description info

            var txtDescription1 = new Label
            {
                Text  = contentUI.TxtDescription1,
                Style = LabelStyles.DescriptionLightStyle.FromResources <Style>()
            };

            var stackDescriptionBullet1 = new StackLayout
            {
                Padding     = new Thickness(12, 0, 0, 0),
                Orientation = StackOrientation.Horizontal,
                Children    =
                {
                    new Label
                    {
                        VerticalOptions = LayoutOptions.Start,
                        Text            = contentUI.TxtDescriptionBulletSymbol,
                        Style           = LabelStyles.DescriptionLightStyle.FromResources <Style>()
                    },
                    new Label
                    {
                        Text  = contentUI.TxtDescriptionBullet1,
                        Style = LabelStyles.DescriptionLightStyle.FromResources <Style>()
                    }
                }
            };

            var stackDescriptionBullet2 = new StackLayout
            {
                Padding     = new Thickness(12, 0, 0, 0),
                Orientation = StackOrientation.Horizontal,
                Children    =
                {
                    new Label
                    {
                        VerticalOptions = LayoutOptions.Start,
                        Text            = contentUI.TxtDescriptionBulletSymbol,
                        Style           = LabelStyles.DescriptionLightStyle.FromResources <Style>()
                    },
                    new Label
                    {
                        Text  = contentUI.TxtDescriptionBullet2,
                        Style = LabelStyles.DescriptionLightStyle.FromResources <Style>()
                    }
                }
            };

            var stackDescriptionBullet3 = new StackLayout
            {
                Padding     = new Thickness(12, 0, 0, 0),
                Orientation = StackOrientation.Horizontal,
                Children    =
                {
                    new Label
                    {
                        VerticalOptions = LayoutOptions.Start,
                        Text            = contentUI.TxtDescriptionBulletSymbol,
                        Style           = LabelStyles.DescriptionLightStyle.FromResources <Style>()
                    },
                    new Label
                    {
                        Text  = contentUI.TxtDescriptionBullet3,
                        Style = LabelStyles.DescriptionLightStyle.FromResources <Style>()
                    }
                }
            };

            var stackDescriptionBullet4 = new StackLayout
            {
                Padding     = new Thickness(12, 0, 0, 0),
                Orientation = StackOrientation.Horizontal,
                Children    =
                {
                    new Label
                    {
                        VerticalOptions = LayoutOptions.Start,
                        Text            = contentUI.TxtDescriptionBulletSymbol,
                        Style           = LabelStyles.DescriptionLightStyle.FromResources <Style>()
                    },
                    new Label
                    {
                        Text  = contentUI.TxtDescriptionBullet4,
                        Style = LabelStyles.DescriptionLightStyle.FromResources <Style>()
                    }
                }
            };

            var txtDescription2 = new Label
            {
                Text  = contentUI.TxtDescription2,
                Style = LabelStyles.DescriptionLightStyle.FromResources <Style>()
            };

            var tapEmailAlternate = new TapGestureRecognizer
            {
                CommandParameter = contentUI.TxtEmailAlternateValue
            };
            tapEmailAlternate.Tapped += viewModel.TxtEmail_Click;

            var txtDescription3 = new Label
            {
                Style         = LabelStyles.DescriptionLightStyle.FromResources <Style>(),
                FormattedText = new FormattedString
                {
                    Spans =
                    {
                        new Span
                        {
                            Text = contentUI.TxtDescription3
                        },
                        new Span
                        {
                            Text               = contentUI.TxtEmailAlternateValue,
                            TextDecorations    = TextDecorations.Underline,
                            GestureRecognizers =
                            {
                                tapEmailAlternate
                            }
                        }
                    }
                }
            };

            var stackDescription = new StackLayout
            {
                Spacing  = 0,
                Children =
                {
                    txtDescription1,
                    stackDescriptionBullet1,
                    stackDescriptionBullet2,
                    stackDescriptionBullet3,
                    stackDescriptionBullet4,
                    txtDescription2,
                    txtDescription3
                }
            };

            #endregion

            #region Version info

            var txtTitleVersion = new Label
            {
                Text      = contentUI.TitleVersion,
                Style     = LabelStyles.DescriptionStyle.FromResources <Style>(),
                TextColor = MainStyles.LightTextColor.FromResources <Color>(),
                Opacity   = 0.5
            };

            var txtNumberVersion = new Label
            {
                Text  = contentUI.TxtVersionValue,
                Style = LabelStyles.DescriptionLightStyle.FromResources <Style>()
            };

            var stackVersion = new StackLayout
            {
                Children =
                {
                    txtTitleVersion,
                    txtNumberVersion
                }
            };

            #endregion

            #region Developer info

            var txtTitleDeveloper = new Label
            {
                Text      = contentUI.TitleDeveloper,
                Style     = LabelStyles.DescriptionStyle.FromResources <Style>(),
                TextColor = MainStyles.LightTextColor.FromResources <Color>(),
                Opacity   = 0.5
            };

            #region Phone

            var txtPhoneSymbol = new Label
            {
                Text      = contentUI.TxtPhoneSymbol,
                Style     = LabelStyles.DescriptionStyle.FromResources <Style>(),
                TextColor = MainStyles.LightTextColor.FromResources <Color>()
            };

            var txtPhone = new Label
            {
                Text      = contentUI.TxtPhoneValue,
                Style     = LabelStyles.DescriptionStyle.FromResources <Style>(),
                TextColor = MainStyles.LightTextColor.FromResources <Color>()
            };

            var tapPhone = new TapGestureRecognizer
            {
                CommandParameter = contentUI.TxtPhoneValue
            };
            tapPhone.Tapped += viewModel.TxtPhone_Click;

            var stackPhone = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                Children    =
                {
                    txtPhoneSymbol,
                    txtPhone
                }
            };

            stackPhone.GestureRecognizers.Add(tapPhone);

            #endregion

            #region Email

            var txtEmailSymbol = new Label
            {
                Text      = contentUI.TxtEmailSymbol,
                Style     = LabelStyles.DescriptionStyle.FromResources <Style>(),
                TextColor = MainStyles.LightTextColor.FromResources <Color>()
            };

            var txtEmail = new Label
            {
                Text      = contentUI.TxtEmailValue,
                Style     = LabelStyles.LinkStyle.FromResources <Style>(),
                TextColor = MainStyles.LightTextColor.FromResources <Color>()
            };

            var tapEmail = new TapGestureRecognizer
            {
                CommandParameter = contentUI.TxtEmailValue
            };
            tapEmail.Tapped += viewModel.TxtEmail_Click;

            var stackEmail = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                Children    =
                {
                    txtEmailSymbol,
                    txtEmail
                }
            };

            stackEmail.GestureRecognizers.Add(tapEmail);

            #endregion

            #region Http

            var txtHttpSymbol = new Label
            {
                Text      = contentUI.TxtHttpSymbol,
                Style     = LabelStyles.DescriptionStyle.FromResources <Style>(),
                TextColor = MainStyles.LightTextColor.FromResources <Color>()
            };

            var txtHttp = new Label
            {
                Text      = contentUI.TxtHttpValue,
                Style     = LabelStyles.LinkStyle.FromResources <Style>(),
                TextColor = MainStyles.LightTextColor.FromResources <Color>()
            };

            var tapHttp = new TapGestureRecognizer
            {
                CommandParameter = contentUI.TxtHttpValue
            };
            tapHttp.Tapped += viewModel.TxtLink_Click;

            var stackHttp = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                Children    =
                {
                    txtHttpSymbol,
                    txtHttp
                }
            };

            stackHttp.GestureRecognizers.Add(tapHttp);

            #endregion

            var stackDeveloper = new StackLayout
            {
                Children =
                {
                    txtTitleDeveloper,
                    stackPhone,
                    stackEmail,
                    stackHttp
                }
            };

            #endregion

            var stackAbout = new StackLayout
            {
                Padding  = 24,
                Spacing  = 20,
                Children =
                {
                    imgLogo,
                    txtTitle,
                    stackDescription,
                    stackVersion,
                    stackDeveloper
                }
            };

            var scrollView = new ScrollView
            {
                Content = stackAbout
            };

            var safeAreaHelper = new SafeAreaHelper();
            safeAreaHelper.UseSafeArea(this, SafeAreaHelper.CustomSafeAreaFlags.Top);
            safeAreaHelper.UseSafeArea(appBar.BtnBack, SafeAreaHelper.CustomSafeAreaFlags.Left);
            safeAreaHelper.UseSafeArea(scrollView, SafeAreaHelper.CustomSafeAreaFlags.Horizontal);

            ContentLayout.Children.Add(appBar);
            ContentLayout.Children.Add(scrollView);
        }
        private void TBForegroundColor_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            var value = _expando[TBForegroundColor] as ValueHolder;

            TitleBar.SetForegroundColor(this, (value.Value as SolidColorBrush).Color);
        }
Exemplo n.º 11
0
        public override void InitWindow()
        {
            //window init
            SetParameters(nameof(MainWindow), nameof(MainWindow), 1300, 840, false);
            SetMinSize(500, 300);
            SetBackground(32, 34, 37);

            //title
            title = new TitleBar("Mimic");
            title.SetStyle(Styles.GetTitleBarStyle());

            HorizontalStack h_stack = new HorizontalStack();

            h_stack.SetMargin(0, 22, 0, 0);
            h_stack.SetSpacing(0, 0);

            //left block
            VerticalStack left = new VerticalStack();//70

            left.SetWidth(70);
            left.SetWidthPolicy(SizePolicy.Fixed);
            left.SetPadding(2, 0, 2, 2);
            left.SetSpacing(0, 10);

            SpaceVIL.Rectangle line = new SpaceVIL.Rectangle();
            line.SetBackground(32, 34, 37);
            line.SetSizePolicy(SizePolicy.Expand, SizePolicy.Fixed);
            line.SetHeight(1);
            line.SetShadow(2, 0, 2, Color.FromArgb(150, 0, 0, 0));
            line.SetMargin(8, 0, 8, 0);

            ButtonCore mimic_icon = new ButtonCore("M");

            mimic_icon.SetFont(new Font(DefaultsService.GetDefaultFont().FontFamily, 30, FontStyle.Bold));
            mimic_icon.SetSize(50, 50);
            mimic_icon.SetBackground(114, 137, 208);
            mimic_icon.SetAlignment(ItemAlignment.Top | ItemAlignment.HCenter);
            mimic_icon.SetBorderRadius(new CornerRadius(15));

            SpaceVIL.Rectangle divider = new SpaceVIL.Rectangle();
            divider.SetBackground(47, 49, 54);
            divider.SetSizePolicy(SizePolicy.Expand, SizePolicy.Fixed);
            divider.SetHeight(2);
            divider.SetMargin(15, 0, 15, 0);

            ButtonToggle notes_area_btn = new ButtonToggle("N");

            notes_area_btn.SetFont(new Font(DefaultsService.GetDefaultFont().FontFamily, 30, FontStyle.Bold));
            notes_area_btn.SetSize(50, 50);
            notes_area_btn.SetBackground(Color.Transparent);
            notes_area_btn.SetForeground(100, 101, 105);
            notes_area_btn.SetAlignment(ItemAlignment.Top | ItemAlignment.HCenter);
            notes_area_btn.SetBorderRadius(new CornerRadius(15));
            notes_area_btn.SetBorderFill(100, 101, 105);
            notes_area_btn.SetBorderThickness(1);
            notes_area_btn.EventMouseClick += (sender, args) =>
            {
                if (notes_area_btn.IsToggled())
                {
                    freeNotes.SetVisible(true);
                    conversation.SetVisible(false);
                    freeNotes.GetParent().Update(GeometryEventType.ResizeHeight);
                }
                else
                {
                    freeNotes.SetVisible(false);
                    conversation.SetVisible(true);
                    freeNotes.GetParent().Update(GeometryEventType.ResizeHeight);
                }
            };

            ButtonCore add_btn = new ButtonCore();

            add_btn.SetSize(50, 50);
            add_btn.SetBackground(Color.Transparent);
            add_btn.SetAlignment(ItemAlignment.Top | ItemAlignment.HCenter);
            add_btn.SetBorderRadius(new CornerRadius(25));
            add_btn.SetBorderFill(100, 101, 105);
            add_btn.SetBorderThickness(1);
            add_btn.SetToolTip("Add a new friend.");
            add_btn.EventMouseClick += (sender, args) =>
            {
                AddMenuDialog dialog = new AddMenuDialog();
                dialog.OnCloseDialog += () =>
                {
                    string result = dialog.InputResult;
                    if (!result.Equals(String.Empty))
                    {
                        contacts_bar.AddItem(InfinityItemsBox.GetVisualContact(result, input_message));
                    }
                };
                dialog.Show(this);
            };

            CustomShape plus = new CustomShape();

            plus.SetBackground(100, 101, 105);
            plus.SetSize(20, 20);
            plus.SetAlignment(ItemAlignment.VCenter | ItemAlignment.HCenter);
            plus.SetTriangles(GraphicsMathService.GetCross(20, 20, 2, 0));

            //middleblock
            VerticalStack middle = new VerticalStack();//240

            middle.SetStyle(Styles.GetCommonContainerStyle());
            middle.SetWidth(240);
            middle.SetWidthPolicy(SizePolicy.Fixed);
            middle.SetBackground(47, 49, 54);
            middle.SetBorderRadius(new CornerRadius(6, 0, 6, 0));

            Frame search_bar = new Frame();

            search_bar.SetBorderRadius(new CornerRadius(6, 0, 0, 0));
            search_bar.SetBackground(47, 49, 54);
            search_bar.SetHeight(48);
            search_bar.SetPadding(15, 0, 15, 0);
            search_bar.SetHeightPolicy(SizePolicy.Fixed);
            search_bar.SetShadow(2, 0, 2, Color.FromArgb(150, 0, 0, 0));

            contacts_bar = new ListBox();
            contacts_bar.SetPadding(8, 8, 8, 8);
            contacts_bar.SetBackground(Color.Transparent);
            contacts_bar.SetHScrollBarVisible(ScrollBarVisibility.Never);
            contacts_bar.SetVScrollBarVisible(ScrollBarVisibility.Never);
            contacts_bar.SetSelectionVisible(false);

            Frame user_bar = new Frame();

            user_bar.SetBorderRadius(new CornerRadius(0, 0, 6, 0));
            user_bar.SetBackground(42, 44, 49);
            user_bar.SetHeight(48);
            user_bar.SetPadding(15, 0, 15, 0);
            user_bar.SetHeightPolicy(SizePolicy.Fixed);
            user_bar.SetAlignment(ItemAlignment.Bottom);

            TextEdit search = new TextEdit();

            search.SetPadding(10, 0, 10, 0);
            search.SetFont(DefaultsService.GetDefaultFont(12));
            search.SetForeground(150, 150, 150);
            search.SetSubstrateText("Find or start conversation");
            search.SetSubstrateFontSize(12);
            search.SetSubstrateFontStyle(FontStyle.Regular);
            search.SetSubstrateForeground(100, 100, 100);
            search.SetHeight(32);
            search.SetBackground(37, 39, 43);
            search.SetAlignment(ItemAlignment.HCenter, ItemAlignment.VCenter);
            search.SetBorderRadius(4);
            search.SetBorderThickness(1);
            search.SetBorderFill(32, 34, 37);

            //right block
            VerticalStack right = new VerticalStack();//expand

            right.SetStyle(Styles.GetCommonContainerStyle());
            right.SetSpacing(0, 2);

            HorizontalStack conversation_bar = new HorizontalStack();

            conversation_bar.SetBackground(54, 57, 63);
            conversation_bar.SetHeight(48);
            conversation_bar.SetHeightPolicy(SizePolicy.Fixed);
            conversation_bar.SetPadding(10, 0, 0, 0);
            conversation_bar.SetSpacing(5, 0);
            conversation_bar.SetShadow(2, 0, 2, Color.FromArgb(150, 0, 0, 0));

            freeNotes = new FreeArea();
            freeNotes.SetVisible(false);
            freeNotes.SetBackground(Color.FromArgb(5, 255, 255, 255));

            conversation = new ListBox();
            conversation.SetPadding(4, 4, 4, 4);
            conversation.SetBackground(Color.Transparent);
            conversation.SetHScrollBarVisible(ScrollBarVisibility.Never);
            conversation.GetArea().SetPadding(16, 10, 2, 2);
            conversation.SetSelectionVisible(false);

            VerticalScrollBar vs = conversation.VScrollBar;

            vs.SetWidth(16);
            vs.SetBorderThickness(4);
            vs.SetBorderFill(54, 57, 63);
            vs.SetBorderRadius(new CornerRadius(9));
            vs.SetArrowsVisible(false);
            vs.SetBackground(47, 49, 54);
            vs.SetPadding(0, 0, 0, 0);
            vs.Slider.Track.SetBackground(Color.Transparent);
            vs.Slider.SetBorderThickness(4);
            vs.Slider.SetBorderFill(54, 57, 63);
            vs.Slider.SetBorderRadius(new CornerRadius(9));
            vs.Slider.SetBackground(32, 34, 37, 255);
            vs.Slider.SetMargin(new Indents(0, 0, 0, 0));
            vs.Slider.RemoveAllItemStates();

            HorizontalStack input_bar = new HorizontalStack();

            input_bar.SetHeight(44);
            input_bar.SetHeightPolicy(SizePolicy.Fixed);
            input_bar.SetMargin(20, 10, 20, 30);
            input_bar.SetPadding(15, 0, 8, 0);
            input_bar.SetSpacing(10, 0);
            input_bar.SetBackground(72, 75, 81);
            input_bar.SetBorderRadius(new CornerRadius(6, 6, 6, 6));

            ButtonCore emoji = new ButtonCore("+");

            emoji.SetSize(24, 24);
            emoji.SetBackground(126, 128, 132);
            emoji.SetAlignment(ItemAlignment.VCenter | ItemAlignment.Left);
            emoji.SetBorderRadius(new CornerRadius(12));

            SpaceVIL.Rectangle divider_v = new SpaceVIL.Rectangle();
            divider_v.SetBackground(126, 128, 132);
            divider_v.SetWidth(2);
            divider_v.SetSizePolicy(SizePolicy.Fixed, SizePolicy.Expand);
            divider_v.SetMargin(0, 10, 0, 10);

            input_message = new TextEdit();
            input_message.SetBackground(Color.Transparent);
            input_message.SetForeground(Color.White);
            input_message.SetAlignment(ItemAlignment.VCenter);
            input_message.SetBorderRadius(new CornerRadius(0, 3, 0, 3));
            input_message.SetSubstrateText("Message @Jackson");
            input_message.EventKeyPress += (sender, args) =>
            {
                if (args.Key == KeyCode.Enter)
                {
                    conversation.AddItem(InfinityItemsBox.GetMessage(input_message.GetText()));
                    input_message.Clear();
                }
            };

            ButtonCore add_note = InfinityItemsBox.GetOrdinaryButton();

            add_note.SetForeground(166, 167, 168);
            add_note.SetFont(new Font(DefaultsService.GetDefaultFont().FontFamily, 12, FontStyle.Bold));
            add_note.SetText("Add new note");
            add_note.SetWidth(100);
            add_note.SetShadow(4, 0, 2, Color.FromArgb(150, 0, 0, 0));
            add_note.EventMouseClick += (sender, args) =>
            {
                NoteBlock block = InfinityItemsBox.GetNoteBlock();
                block.SetPosition(100, 100);
                freeNotes.AddItem(block);
            };

            //adding items
            AddItems(
                title,
                h_stack
                );
            h_stack.AddItems(
                left,
                middle,
                right
                );
            left.AddItems(
                line,
                mimic_icon,
                divider,
                notes_area_btn,
                add_btn
                );
            add_btn.AddItem(
                plus
                );
            middle.AddItems(
                search_bar,
                contacts_bar,
                user_bar
                );
            search_bar.AddItems(
                search
                );
            user_bar.AddItems(
                new UserBar("Daniel")
                );
            right.AddItems(
                conversation_bar,
                conversation,
                freeNotes,
                input_bar
                );
            conversation_bar.AddItems(
                add_note,
                InfinityItemsBox.GetOrdinaryButton(),
                InfinityItemsBox.GetOrdinaryButton(),
                InfinityItemsBox.GetOrdinaryButton(),
                InfinityItemsBox.GetOrdinaryButton()
                );
            input_bar.AddItems(
                emoji,
                divider_v,
                input_message
                );
            contacts_bar.AddItems(
                InfinityItemsBox.GetVisualContact("Jackson", input_message),
                InfinityItemsBox.GetVisualContact("Evelyn", input_message),
                InfinityItemsBox.GetVisualContact("Alexander", input_message),
                InfinityItemsBox.GetVisualContact("Matthew", input_message)
                );
        }
Exemplo n.º 12
0
        /// <summary>
        /// Apply top form margins
        /// </summary>
        private void ApplyTopFormMargins()
        {
            int     topOffset = 0;
            Margins margins   = GetMargins(out topOffset);

            if (topOffset == 0)
            {
                TopMargin.Top    = FormsPanel.Top;
                TopMargin.Left   = FormsPanel.Left;
                TopMargin.Width  = FormsPanel.Width;
                TopMargin.Height = margins.Bottom;

                TitleBar.Top    = TopMargin.Bottom;
                TitleBar.Left   = TopMargin.Left;
                TitleBar.Width  = TopMargin.Width;
                TitleBar.Height = margins.Top - margins.Bottom;

                BottomMargin.Top    = FormsPanel.Bottom - margins.Bottom;
                BottomMargin.Left   = TopMargin.Left;
                BottomMargin.Width  = TopMargin.Width;
                BottomMargin.Height = margins.Bottom;


                LeftMargin.Top    = TitleBar.Bottom;
                LeftMargin.Left   = FormsPanel.Left;
                LeftMargin.Width  = margins.Left;
                LeftMargin.Height = BottomMargin.Top - TitleBar.Bottom;

                RightMargin.Top    = TitleBar.Bottom;
                RightMargin.Left   = FormsPanel.Right - margins.Right;
                RightMargin.Width  = margins.Right;
                RightMargin.Height = BottomMargin.Top - TitleBar.Bottom;

                _titleRenderer.ContentTopOffset = 0;
            }
            else
            {
                TopMargin.Top    = FormsPanel.Top - margins.Top;
                TopMargin.Left   = 0;
                TopMargin.Width  = Width;
                TopMargin.Height = DefaultTopMargin;

                TitleBar.Top    = TopMargin.Bottom;
                TitleBar.Left   = TopMargin.Left;
                TitleBar.Width  = TopMargin.Width;
                TitleBar.Height = DefaultTitleHeight;

                BottomMargin.Top    = FormsPanel.Bottom;
                BottomMargin.Left   = TopMargin.Left;
                BottomMargin.Width  = TopMargin.Width;
                BottomMargin.Height = margins.Bottom;


                LeftMargin.Top    = TitleBar.Bottom;
                LeftMargin.Left   = FormsPanel.Left - margins.Left;
                LeftMargin.Width  = margins.Left;
                LeftMargin.Height = BottomMargin.Top - TitleBar.Bottom;

                RightMargin.Top    = TitleBar.Bottom;
                RightMargin.Left   = FormsPanel.Right;
                RightMargin.Width  = margins.Right;
                RightMargin.Height = BottomMargin.Top - TitleBar.Bottom;

                _titleRenderer.ContentTopOffset = DefaultTopTitleOffset;
            }


            FormsContainerControlCollection forms = (FormsContainerControlCollection)FormsPanel.Controls;

            Form selectedForm = forms.TopControl as Form;

            if (selectedForm != null)
            {
                _titleRenderer.Icon = selectedForm.Icon;
                _titleRenderer.Text = selectedForm.Text;

                selectedForm.Bounds = FormsPanel.ClientRectangle;
            }

            _titleRenderer.TitleBarBounds = TitleBar.ClientRectangle;


            TitleBar.Invalidate();
        }
Exemplo n.º 13
0
 private void TitleBarCheckbox_Unchecked(object sender, RoutedEventArgs e)
 {
     //CoreApplicationViewTitleBar titleBar = CoreApplication.GetCurrentView().TitleBar;
     //titleBar.ExtendViewIntoTitleBar = true;
     TitleBar.SetExtendViewIntoTitleBar(Application.Current.MainWindow, true);
 }
Exemplo n.º 14
0
        public FeedbackPage()
            : base(typeof(FeedbackViewModel), typeof(FeedbackContentUI))
        {
            BackgroundColor         = MainStyles.StatusBarColor.FromResources <Color>();
            Content.BackgroundColor = MainStyles.MainBackgroundColor.FromResources <Color>();

            var loadingColor = MainStyles.LoadingColor.FromResources <Color>();

            LoadingActivityIndicator.Color = loadingColor;
            LoadingActivityText.TextColor  = loadingColor;

            var appBar = new TitleBar(this, TitleBar.BarBtnEnum.bbBack)
            {
                BarColor   = MainStyles.StatusBarColor.FromResources <Color>(),
                TitleStyle = LabelStyles.PageTitleStyle.FromResources <Style>(),
                BtnBack    =
                {
                    Source = contentUI.IconBack
                }
            };

            appBar.SetBinding(TitleBar.TitleProperty, "Title");

            var txtNameTitle = new Label
            {
                Style = LabelStyles.FeedbackLabelStyle.FromResources <Style>(),
                Text  = contentUI.TxtName
            };

            _txtName = new Entry
            {
                Style     = LabelStyles.FeedbackEntryStyle.FromResources <Style>(),
                MaxLength = 30
            };
            _txtName.SetBinding(Entry.TextProperty, "Name");
            _txtName.SetBinding(IsEnabledProperty, "IsNotLoading");

            var txtCommentTitle = new Label
            {
                Style = LabelStyles.FeedbackLabelStyle.FromResources <Style>(),
                Text  = contentUI.TxtComment
            };

            _txtComment = new Editor
            {
                Style           = LabelStyles.FeedbackEditorStyle.FromResources <Style>(),
                VerticalOptions = LayoutOptions.FillAndExpand,
                MaxLength       = 1000
            };
            _txtComment.SetBinding(Editor.TextProperty, "Comment");
            _txtComment.SetBinding(IsEnabledProperty, "IsNotLoading");

            var btnSubmit = new ButtonExtended
            {
                Style             = LabelStyles.ButtonStyle.FromResources <Style>(),
                Text              = contentUI.TxtSubmit.ToUpper(),
                HorizontalOptions = LayoutOptions.Center,
                WidthRequest      = 150
            };

            btnSubmit.SetBinding(IsEnabledProperty, "IsValidFeedback");
            btnSubmit.SetBinding(IsVisibleProperty, "IsNotLoading");
            btnSubmit.Clicked += viewModel.BtnSubmit_Clicked;

            var activityIndicator = new ActivityIndicator
            {
                Color             = loadingColor,
                HorizontalOptions = LayoutOptions.Center
            };

            activityIndicator.SetBinding(IsVisibleProperty, "IsSubmitting");
            activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, "IsSubmitting");

            _layoutFeedback = new KeyboardView
            {
                RowDefinitions = new RowDefinitionCollection
                {
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                    new RowDefinition {
                        Height = GridLength.Star
                    },
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                    new RowDefinition {
                        Height = GridLength.Auto
                    }
                }
            };

            _layoutFeedback.Children.Add(txtNameTitle, 0, 0);
            _layoutFeedback.Children.Add(_txtName, 0, 1);
            _layoutFeedback.Children.Add(txtCommentTitle, 0, 2);
            _layoutFeedback.Children.Add(_txtComment, 0, 3);
            _layoutFeedback.Children.Add(btnSubmit, 0, 4);
            _layoutFeedback.Children.Add(activityIndicator, 0, 5);

            var layoutContainer = new ContentView
            {
                Padding         = 24,
                Content         = _layoutFeedback,
                VerticalOptions = LayoutOptions.FillAndExpand
            };

            var safeAreaHelper = new SafeAreaHelper();

            safeAreaHelper.UseSafeArea(this, SafeAreaHelper.CustomSafeAreaFlags.Top);
            safeAreaHelper.UseSafeArea(appBar.BtnBack, SafeAreaHelper.CustomSafeAreaFlags.Left);
            safeAreaHelper.UseSafeArea(layoutContainer, SafeAreaHelper.CustomSafeAreaFlags.Horizontal);

            ContentLayout.Children.Add(appBar);
            ContentLayout.Children.Add(layoutContainer);
        }
Exemplo n.º 15
0
        /// <summary>
        /// Create AlarmEditPage's UI
        /// </summary>
        private void Draw()
        {
            // Hide navigation bar (title and buttons)
            NavigationPage.SetHasNavigationBar(this, false);

            // Create TitleBar
            titleBar = new TitleBar();
            titleBar.LeftButton.Text      = "CANCEL";
            titleBar.RightButton.Text     = "DONE";
            titleBar.TitleLabel.Text      = "Create";
            titleBar.LeftButton.Clicked  += CANCEL_Clicked;
            titleBar.RightButton.Clicked += DONE_Clicked;

            // Create time edit cell
            editTimePickerCell = new AlarmEditTimePickerCell(AlarmModel.BindableAlarmRecord);
            editTimePickerCell.SetBinding(AlarmEditTimePickerCell.TimeProperty, new Binding("ScheduledDateTime", BindingMode.Default, source: AlarmModel.BindableAlarmRecord));

            // Create repeat edit cell
            TextCell repeatTextCell = new TextCell
            {
                Text    = "Repeat weekly",
                Detail  = "Never",
                Command = new Command(async() =>
                {
                    await Navigation.PushAsync(AlarmPageController.GetInstance(AlarmPages.RepeatPage));
                })
            };

            repeatTextCell.SetBinding(TextCell.DetailProperty, new Binding("WeekFlag", mode: BindingMode.Default, converter: new AlarmValueConverter(), source: AlarmModel.BindableAlarmRecord));

            // Create alarm type cell
            TextCell typeTextCell = new TextCell
            {
                Text    = "Alarm type",
                Detail  = "Sound",
                Command = new Command(async() =>
                {
                    await Navigation.PushAsync(AlarmPageController.GetInstance(AlarmPages.TypePage));
                })
            };

            typeTextCell.SetBinding(TextCell.DetailProperty, new Binding("AlarmType", mode: BindingMode.Default, converter: new AlarmValueConverter(), source: AlarmModel.BindableAlarmRecord));

            // Create sound type cell
            AlarmEditSliderCell soundVolumeCell = new AlarmEditSliderCell(AlarmModel.BindableAlarmRecord);

            // Create tone selection cell
            TextCell toneTextCell = new TextCell
            {
                Text    = "Alarm tone",
                Detail  = "Default",
                Command = new Command(async() =>
                {
                    await Navigation.PushAsync(AlarmPageController.GetInstance(AlarmPages.TonePage));
                })
            };

            toneTextCell.SetBinding(TextCell.DetailProperty, new Binding("AlarmToneType", mode: BindingMode.Default, converter: new AlarmValueConverter(), source: AlarmModel.BindableAlarmRecord));

            // Create snooze setting cell
            MultilineCell snoozeMultilineCell = new MultilineCell
            {
                Text           = "Snooze",
                Multiline      = "Sound the alarm 3 times, at 5-minute intervals.",
                IsCheckVisible = true,
                IsChecked      = true,
            };

            snoozeMultilineCell.SetBinding(MultilineCell.IsCheckedProperty, new Binding("Snooze", BindingMode.TwoWay, source: AlarmModel.BindableAlarmRecord));

            // Create name setting cell
            nameCell = new AlarmEditNameCell(AlarmModel.BindableAlarmRecord);

            // TableRoot
            TableRoot root = new TableRoot()
            {
                new TableSection()
                {
                    editTimePickerCell,
                    repeatTextCell,
                    typeTextCell,
                    soundVolumeCell,
                    toneTextCell,
                    snoozeMultilineCell,
                    nameCell,
                }
            };

            TableView alarmEditTable = new TableView
            {
                Root          = root,
                HasUnevenRows = true,
            };

            // Main layout for AlarmEditPage
            StackLayout mainLayout = new StackLayout
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                BindingContext    = AlarmModel.BindableAlarmRecord,
                Children          =
                {
                    titleBar,
                    alarmEditTable
                }
            };

            Content = mainLayout;
        }
Exemplo n.º 16
0
        /// <summary>
        /// Apply LeaveLayout.
        /// </summary>
        public void ApplyLeaveLayout()
        {
            TitleBar    lblPageName = new TitleBar("Apply Leave");
            StackLayout slTitle     = new StackLayout
            {
                Orientation     = StackOrientation.Horizontal,
                Padding         = new Thickness(0, 5, 0, 0),
                BackgroundColor = Color.White,
                Children        = { lblPageName }
            };

            Seperator spTitle = new Seperator();

            Image imgStartDateDropDown = new Image {
                Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand
            };
            Label lblCurrentDate = new Label {
                TextColor = Color.Black
            };

            lblCurrentDate.Text = DateTime.Now.ToString("dd-MM-yy");
            DatePicker dtStartDate = new DatePicker {
                IsVisible = false
            };

            StackLayout slStartDateDisplay = new StackLayout {
                Children = { lblCurrentDate, dtStartDate, imgStartDateDropDown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 10, 0), Device.OnPlatform(0, 5, 0))
            };

            //Frame layout for start date
            Frame frmStartDate = new Frame
            {
                Content           = slStartDateDisplay,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                OutlineColor      = Color.Black,
                Padding           = new Thickness(10)
            };

            var currentDateTap = new TapGestureRecognizer();

            currentDateTap.NumberOfTapsRequired = 1; // single-tap
            currentDateTap.Tapped += (s, e) =>
            {
                dtStartDate.Focus();
            };
            frmStartDate.GestureRecognizers.Add(currentDateTap);
            slStartDateDisplay.GestureRecognizers.Add(currentDateTap);

            dtStartDate.DateSelected += (s, e) =>
            {
                lblCurrentDate.Text = (dtStartDate).Date.ToString("dd-MM-yyyy");
            };

            //dtStartDate.Unfocused += (sender, e) =>
            //{
            //    if (lblCurrentDate.Text == "Date")
            //    {
            //        lblCurrentDate.Text = DateTime.Now.ToString("dd-MM-yy");
            //    }
            //};

            StackLayout slStartDateFrmaeLayout = new StackLayout
            {
                Children = { frmStartDate }
            };

            StackLayout slStartDateLayout = new StackLayout
            {
                Children          = { slStartDateFrmaeLayout },
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            //ExtendedEntry txtReasonOfLeave = new ExtendedEntry
            //{
            //    TextColor = Color.Black,
            //    Placeholder = "Reason of leave"
            //};

            Label lblReasonOfLeave = new Label
            {
                TextColor = Color.Black,
                Text      = "Reason of leave"
            };

            StackLayout slLabelReasonOfLeave = new StackLayout
            {
                Children = { lblReasonOfLeave },
                Padding  = new Thickness(0, 0, 0, 10)
            };

            Editor txtReasonOfLeave = new Editor
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                HeightRequest   = 80
                                  //TextColor = Color.Gray
            };

            StackLayout slTextReasonOfLeave = new StackLayout
            {
                Children = { txtReasonOfLeave },
                Padding  = new Thickness(0, 0, 0, 10)
            };

            StackLayout slReasonOfLeave = new StackLayout
            {
                Children          = { slLabelReasonOfLeave, slTextReasonOfLeave },
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Orientation       = StackOrientation.Vertical
            };

            //txtReasonOfLeave.Focused += (sender, e) =>
            //    {
            //        if (txtReasonOfLeave.Text == "Reason of leave")
            //        {
            //            txtReasonOfLeave.Text = string.Empty;
            //            //txtReasonOfLeave.TextColor = Color.Black;
            //        }
            //    };

            ExtendedEntry txtNoOfDays = new ExtendedEntry
            {
                TextColor   = Color.Black,
                Keyboard    = Keyboard.Numeric,
                Placeholder = "Enter no of days"
            };

            StackLayout slNoOfDaysLayout = new StackLayout
            {
                Children          = { txtNoOfDays },
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            StackLayout slSearchLayout = new StackLayout
            {
                Orientation = StackOrientation.Vertical,
                Padding     = new Thickness(0, 0, 0, 10),
                Children    = { slStartDateLayout, slNoOfDaysLayout, slReasonOfLeave }
            };

            _NotAvailData = new Label {
                Text = "No data availalble for this search data.", TextColor = Color.Red, IsVisible = false
            };

            _Loader = new LoadingIndicator();

            Button btnSave = new Button();

            btnSave.Text            = "Save";
            btnSave.TextColor       = Color.White;
            btnSave.BackgroundColor = LayoutHelper.ButtonColor;

            btnSave.Clicked += (sender, e) =>
            {
                Device.BeginInvokeOnMainThread(async() =>
                {
                    try
                    {
                        if (!string.IsNullOrWhiteSpace(txtNoOfDays.Text) && !string.IsNullOrEmpty(txtReasonOfLeave.Text))
                        {
                            btnSave.IsVisible     = false;
                            _Loader.IsShowLoading = true;

                            TeacherLeaveModel teacherLeaveModel = new TeacherLeaveModel();

                            teacherLeaveModel.ReasonOfLeave = txtReasonOfLeave.Text;
                            teacherLeaveModel.Date          = Convert.ToDateTime(lblCurrentDate.Text).Date.ConvetDatetoDateCounter();
                            teacherLeaveModel.NoOfDays      = Convert.ToInt32(txtNoOfDays.Text);

                            bool isSaveAttendance = await TeacherLeaveModel.ApplyLeave(teacherLeaveModel);

                            if (isSaveAttendance)
                            {
                                await DisplayAlert(string.Empty, "Save Successfully.", Messages.Ok);
                            }
                            else
                            {
                                await DisplayAlert(Messages.Error, "Some problem ocuured when saving data.", Messages.Ok);
                            }
                        }
                        else
                        {
                            await DisplayAlert(Messages.Error, "Please enter all data.", Messages.Ok);
                        }
                        _Loader.IsShowLoading = false;
                        btnSave.IsVisible     = true;
                    }
                    catch (Exception ex)
                    {
                        btnSave.IsVisible     = true;
                        _Loader.IsShowLoading = false;
                    }
                });
            };

            var cvBtnSave = new ContentView
            {
                Padding = new Thickness(10, 5, 10, 10),
                Content = btnSave
            };

            StackLayout slViewAttendance = new StackLayout
            {
                Children =
                {
                    new StackLayout {
                        Padding         = new Thickness(20, Device.OnPlatform(40, 20, 0), 20, 20),
                        Children        = { slTitle, spTitle.LineSeperatorView, slSearchLayout, _NotAvailData, _Loader, cvBtnSave },
                        VerticalOptions = LayoutOptions.FillAndExpand,
                    },
                },
                BackgroundColor = LayoutHelper.PageBackgroundColor
            };

            Content = new ScrollView
            {
                Content = slViewAttendance,
            };
        }
Exemplo n.º 17
0
        public DiscountDetailPage(DiscountDetailData discountDetailData)
            : base(typeof(DiscountDetailViewModel), typeof(DiscountDetailContentUI))
        {
            BackgroundColor         = MainStyles.StatusBarColor.FromResources <Color>();
            Content.BackgroundColor = MainStyles.MainLightBackgroundColor.FromResources <Color>();

            viewModel.SetDiscount(discountDetailData);

            var mainLayout = new AbsoluteLayout
            {
                VerticalOptions = LayoutOptions.FillAndExpand
            };

            var appBar = new TitleBar(this, TitleBar.BarBtnEnum.bbBack)
            {
                BarColor   = Color.Transparent,
                BoxPadding =
                {
                    BackgroundColor = MainStyles.StatusBarColor.FromResources <Color>()
                },
                BtnBack =
                {
                    BackgroundColor = MainStyles.StatusBarColor.FromResources <Color>(),
                    Source          = contentUI.IconBack
                }
            };

            #region Photo

            var imageLayout = new RelativeLayout
            {
                HeightRequest = Device.Idiom == TargetIdiom.Phone ? 200 : 400
            };

            var fileNameConverter = new FileNameToImageConverter();
            var imgPhoto          = new Image
            {
                Aspect = Aspect.AspectFill
            };
            imgPhoto.SetBinding(Image.SourceProperty,
                                new Binding("ImageFileName", BindingMode.Default, fileNameConverter, true));

            imageLayout.Children.Add(imgPhoto,
                                     Constraint.Constant(0),
                                     Constraint.Constant(0),
                                     Constraint.RelativeToParent(parent => parent.Width),
                                     Constraint.RelativeToParent(parent => parent.Height));

            #endregion

            #region Label percent

            const int sizeImgLabel = 60;

            var imgLabel = new Image
            {
                HeightRequest = sizeImgLabel,
                WidthRequest  = sizeImgLabel,
                Source        = contentUI.ImgPercentLabel
            };

            var labelLayout = new AbsoluteLayout();
            AbsoluteLayout.SetLayoutFlags(imgLabel, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds(imgLabel, new Rectangle(0f, 0f, 1f, 1f));
            labelLayout.Children.Add(imgLabel);

            imageLayout.Children.Add(labelLayout,
                                     Constraint.RelativeToParent(parent => parent.Width - sizeImgLabel - 5),
                                     Constraint.RelativeToView(imgPhoto,
                                                               (parent, sibling) => sibling.Y + sibling.Height - sizeImgLabel - 5));

            var spanDiscountPercent = new Span
            {
                Style = LabelStyles.LabelPercentStyle.FromResources <Style>()
            };
            spanDiscountPercent.SetBinding(Span.TextProperty, "DiscountPercent", BindingMode.OneWay);

            var spanDiscountType = new Span
            {
                Style = LabelStyles.LabelPercentSymbolStyle.FromResources <Style>()
            };
            spanDiscountType.SetBinding(Span.TextProperty, "DiscountType", BindingMode.OneWay);

            var txtPercent = new Label
            {
                Rotation      = -15,
                TranslationY  = -1,
                FormattedText = new FormattedString
                {
                    Spans =
                    {
                        spanDiscountPercent,
                        spanDiscountType
                    }
                }
            };

            AbsoluteLayout.SetLayoutFlags(txtPercent, AbsoluteLayoutFlags.PositionProportional);
            AbsoluteLayout.SetLayoutBounds(txtPercent,
                                           new Rectangle(0.5, 0.5, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));
            labelLayout.Children.Add(txtPercent);

            #endregion

            #region WebAddress & Category list

            var flexCategories = new FlexLayout
            {
                Direction      = FlexDirection.Row,
                Wrap           = FlexWrap.Wrap,
                JustifyContent = FlexJustify.Start,
                AlignItems     = FlexAlignItems.Center,
                AlignContent   = FlexAlignContent.Start,
                Margin         = new Thickness(20, 15, 15, 0)
            };

            foreach (var webAddress in viewModel.WebAddresses)
            {
                var imgWebAddress = new Image
                {
                    Source = webAddress.Type.GetWebAddressIcon()
                };

                var viewGesturesWebAddress = new ViewGestures
                {
                    Content         = imgWebAddress,
                    AnimationEffect = ViewGestures.AnimationType.atScaling,
                    AnimationScale  = -5,
                    Tag             = webAddress.Url,
                    Margin          = new Thickness(0, 0, 5, 5)
                };
                viewGesturesWebAddress.Tap += viewModel.TxtUrlAddress_Click;

                flexCategories.Children.Add(viewGesturesWebAddress);
            }

            var flexSeparator = new ContentView();
            FlexLayout.SetGrow(flexSeparator, 1);
            flexCategories.Children.Add(flexSeparator);

            foreach (var category in viewModel.Categories)
            {
                var categoryLayout = new CategoryItemTemplate
                {
                    Margin         = new Thickness(0, 0, 5, 5),
                    BindingContext = category
                };

                flexCategories.Children.Add(categoryLayout);
            }

            #endregion

            #region Name company

            var txtPartnerName = new Label
            {
                Style = LabelStyles.DetailTitleStyle.FromResources <Style>()
            };
            txtPartnerName.SetBinding(Label.TextProperty, "NameCompany");

            #endregion

            #region Description

            var txtDescription = new Label
            {
                Style         = LabelStyles.DescriptionStyle.FromResources <Style>(),
                LineBreakMode = LineBreakMode.WordWrap
            };
            txtDescription.SetBinding(Label.TextProperty, "Description");

            #endregion

            var stackDetails = new StackLayout
            {
                Orientation = StackOrientation.Vertical,
                Padding     = new Thickness(20, 0),
                Children    =
                {
                    txtPartnerName,
                    txtDescription
                }
            };

            var discountLayout = new StackLayout
            {
                Spacing     = 0,
                Orientation = StackOrientation.Vertical,
                Children    =
                {
                    imageLayout,
                    flexCategories,
                    stackDetails
                }
            };

            foreach (var brachItem in viewModel.BranchItems)
            {
                var view = new BranchInfoViewTemplate(contentUI, viewModel).View;
                view.BindingContext = brachItem;

                discountLayout.Children.Add(view);
            }

            var scrollDiscount = new ScrollView
            {
                Content = discountLayout
            };

            AbsoluteLayout.SetLayoutFlags(scrollDiscount, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds(scrollDiscount, new Rectangle(0f, 0f, 1f, 1f));
            mainLayout.Children.Add(scrollDiscount);

            AbsoluteLayout.SetLayoutFlags(appBar,
                                          AbsoluteLayoutFlags.PositionProportional | AbsoluteLayoutFlags.WidthProportional);
            AbsoluteLayout.SetLayoutBounds(appBar, new Rectangle(0f, 0f, 1f, AbsoluteLayout.AutoSize));
            mainLayout.Children.Add(appBar);

            var safeAreaHelper = new SafeAreaHelper();
            safeAreaHelper.UseSafeArea(this, SafeAreaHelper.CustomSafeAreaFlags.Top);
            safeAreaHelper.UseSafeArea(appBar.BtnBack, SafeAreaHelper.CustomSafeAreaFlags.Left);
            safeAreaHelper.UseSafeArea(scrollDiscount, SafeAreaHelper.CustomSafeAreaFlags.Horizontal);

            ContentLayout.Children.Add(mainLayout);
        }
Exemplo n.º 18
0
        /// <summary>
        /// Logbook FillUp Layout.
        /// </summary>
        public void LogbookFillUpLayout()
        {
            TitleBar    lblPageName = new TitleBar("Logbook FillUp");
            StackLayout slTitle     = new StackLayout
            {
                Orientation     = StackOrientation.Horizontal,
                Padding         = new Thickness(0, 5, 0, 0),
                BackgroundColor = Color.White,
                Children        = { lblPageName }
            };

            Seperator spTitle = new Seperator();

            Image imgStartDateDropDown = new Image {
                Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand
            };
            Label lblCurrentDate = new Label {
                TextColor = Color.Black
            };

            lblCurrentDate.Text = DateTime.Now.ToString("dd-MM-yy");
            DatePicker dtStartDate = new DatePicker {
                IsVisible = false
            };

            StackLayout slStartDateDisplay = new StackLayout {
                Children = { lblCurrentDate, dtStartDate, imgStartDateDropDown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 10, 0), Device.OnPlatform(0, 5, 0))
            };

            //Frame layout for start date
            Frame frmStartDate = new Frame
            {
                Content           = slStartDateDisplay,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                OutlineColor      = Color.Black,
                Padding           = new Thickness(10)
            };

            var currentDateTap = new TapGestureRecognizer();

            currentDateTap.NumberOfTapsRequired = 1; // single-tap
            currentDateTap.Tapped += (s, e) =>
            {
                dtStartDate.Focus();
            };
            frmStartDate.GestureRecognizers.Add(currentDateTap);
            slStartDateDisplay.GestureRecognizers.Add(currentDateTap);

            dtStartDate.DateSelected += (s, e) =>
            {
                lblCurrentDate.Text = (dtStartDate).Date.ToString("dd-MM-yyyy");
            };

            //dtStartDate.Unfocused += (sender, e) =>
            //{
            //    if (lblCurrentDate.Text == "Date")
            //    {
            //        lblCurrentDate.Text = DateTime.Now.ToString("dd-MM-yyyy");
            //    }
            //};


            StackLayout slStartDateFrmaeLayout = new StackLayout
            {
                Children = { frmStartDate }
            };

            StackLayout slStartDateLayout = new StackLayout
            {
                Children          = { slStartDateFrmaeLayout },
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            //ExtendedEntry txtTeachingAids = new ExtendedEntry
            //{
            //    TextColor = Color.Black,
            //    Placeholder = "Teaching Aids"
            //};

            Label lblTeachingAids = new Label
            {
                Text      = "Teaching Aids",
                TextColor = Color.Black
            };

            Editor txtTeachingAids = new Editor
            {
                HeightRequest   = 80,
                VerticalOptions = LayoutOptions.FillAndExpand,
            };

            StackLayout slLabelTeachingAids = new StackLayout
            {
                Children = { lblTeachingAids },
                Padding  = new Thickness(0, 0, 0, 10)
            };

            StackLayout slTextTeachingAids = new StackLayout
            {
                Children = { txtTeachingAids },
                Padding  = new Thickness(0, 0, 0, 10)
            };

            //txtTeachingAids.Focused += (sender, e) =>
            //    {
            //        if (txtTeachingAids.Text == "Teaching Aids")
            //        {
            //            txtTeachingAids.Text = string.Empty;
            //            //txtTeachingAids.TextColor = Color.Black;
            //        }
            //    };


            StackLayout slTeachingAidsLayout = new StackLayout
            {
                Children          = { slLabelTeachingAids, slTextTeachingAids },
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Orientation       = StackOrientation.Vertical
            };

            //ExtendedEntry txtComment = new ExtendedEntry
            //{
            //    TextColor = Color.Black,
            //    Placeholder = "Comment"
            //};

            Label lblComment = new Label
            {
                Text      = "Comment",
                TextColor = Color.Black
            };

            Editor txtComment = new Editor
            {
                //TextColor = Color.Gray,
                HeightRequest   = 80,
                VerticalOptions = LayoutOptions.FillAndExpand,
            };

            StackLayout slLabelComment = new StackLayout
            {
                Children = { lblComment },
                Padding  = new Thickness(0, 0, 0, 10)
            };

            StackLayout slTextComment = new StackLayout
            {
                Children = { txtComment },
                Padding  = new Thickness(0, 0, 0, 10)
            };

            //txtComment.Focused += (sender, e) =>
            //    {
            //        if (txtComment.Text == "Comment")
            //        {
            //            txtComment.Text = string.Empty;
            //            //txtComment.TextColor = Color.Black;
            //        }
            //    };

            StackLayout slEditorLayout = new StackLayout
            {
                Children          = { slLabelTeachingAids, slTextTeachingAids },
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Orientation       = StackOrientation.Vertical
            };

            //ExtendedEntry txtLessonPlan = new ExtendedEntry
            //{
            //    TextColor = Color.Black,
            //    Placeholder = "Lesson Plan"
            //};

            Label lblLessonPlan = new Label
            {
                Text      = "Lesson Plan",
                TextColor = Color.Black
            };

            Editor txtLessonPlan = new Editor
            {
                //TextColor = Color.Gray,
                HeightRequest   = 80,
                VerticalOptions = LayoutOptions.FillAndExpand,
            };

            StackLayout slLabelLessonPlan = new StackLayout
            {
                Children = { lblLessonPlan },
                Padding  = new Thickness(0, 0, 0, 10)
            };

            StackLayout slTextLessonPlan = new StackLayout
            {
                Children = { txtLessonPlan },
                Padding  = new Thickness(0, 0, 0, 10)
            };

            //txtLessonPlan.Focused += (sender, e) =>
            //    {
            //        if (txtLessonPlan.Text == "Lesson Plan")
            //        {
            //            txtLessonPlan.Text = string.Empty;
            //            //txtLessonPlan.TextColor = Color.Black;
            //        }
            //    };

            StackLayout slLessonPlanLayout = new StackLayout
            {
                Children          = { slLabelLessonPlan, slTextLessonPlan },
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Orientation       = StackOrientation.Vertical
            };

            Image imgLectureDropDown = new Image {
                Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand
            };
            Label lblLecture = new Label {
                TextColor = Color.Black, Text = "Lecture"
            };
            Picker pcrLecture = new Picker {
                IsVisible = false, Title = "Lecture"
            };

            foreach (LectureModel item in _LectureList)
            {
                pcrLecture.Items.Add(item.LectureName);
            }

            StackLayout slLectureDisplay = new StackLayout {
                Children = { lblLecture, pcrLecture, imgLectureDropDown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 10, 0), Device.OnPlatform(0, 5, 0))
            };

            Frame frmLecture = new Frame
            {
                Content           = slLectureDisplay,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                OutlineColor      = Color.Black,
                Padding           = new Thickness(10)
            };

            var lectureTap = new TapGestureRecognizer();

            lectureTap.NumberOfTapsRequired = 1; // single-tap
            lectureTap.Tapped += (s, e) =>
            {
                pcrLecture.Focus();
            };
            frmLecture.GestureRecognizers.Add(lectureTap);
            slLectureDisplay.GestureRecognizers.Add(lectureTap);

            StackLayout slLectureFrameLayout = new StackLayout
            {
                Children = { frmLecture }
            };

            StackLayout slLectureLayout = new StackLayout
            {
                Children          = { slLectureFrameLayout },
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            StackLayout slSearchLayout = new StackLayout
            {
                Orientation = StackOrientation.Vertical,
                Padding     = new Thickness(0, 0, 0, 10),
                Children    = { slStartDateLayout, slLectureLayout, slTeachingAidsLayout, slLessonPlanLayout, slEditorLayout }
            };

            _NotAvailData = new Label {
                Text = "No data availalble for this search data.", TextColor = Color.Red, IsVisible = false
            };

            _Loader = new LoadingIndicator();

            pcrLecture.SelectedIndexChanged += (sender, e) =>
            {
                Device.BeginInvokeOnMainThread(async() =>
                {
                    string lectureName = lblLecture.Text = pcrLecture.Items[pcrLecture.SelectedIndex];

                    _SelectedLectureID = _LectureList.FirstOrDefault(x => x.LectureName == lectureName).Id;

                    //Exam list call
                    slStartDateLayout.IsVisible = true;
                });
            };


            Button btnSave = new Button();

            btnSave.Text            = "Save";
            btnSave.TextColor       = Color.White;
            btnSave.BackgroundColor = LayoutHelper.ButtonColor;

            btnSave.Clicked += (sender, e) =>
            {
                Device.BeginInvokeOnMainThread(async() =>
                {
                    _Loader.IsShowLoading = true;

                    TeacherLogBookModel teacherLogBook = new TeacherLogBookModel();
                    teacherLogBook.Date         = Convert.ToDateTime(lblCurrentDate.Text).Date.ConvetDatetoDateCounter();
                    teacherLogBook.LessonPlan   = txtLessonPlan.Text;
                    teacherLogBook.TeachingAids = txtTeachingAids.Text;
                    teacherLogBook.Comment      = txtComment.Text;
                    teacherLogBook.LectureId    = _SelectedLectureID; //Convert.ToInt32(txtLectureNo.Text);

                    bool isSaveAttendance = await TeacherLogBookModel.SaveLogBook(teacherLogBook);

                    if (isSaveAttendance)
                    {
                        await DisplayAlert(string.Empty, "Save Successfully.", Messages.Ok);
                    }
                    else
                    {
                        await DisplayAlert(Messages.Error, "Some problem ocuured when saving data.", Messages.Ok);
                    }
                    _Loader.IsShowLoading = false;
                });
            };

            var cvBtnSave = new ContentView
            {
                Padding = new Thickness(10, 5, 10, 10),
                Content = btnSave
            };

            StackLayout slViewAttendance = new StackLayout
            {
                Children =
                {
                    new StackLayout {
                        Padding         = new Thickness(20, Device.OnPlatform(40, 20, 0), 20, 20),
                        Children        = { slTitle, spTitle.LineSeperatorView, slSearchLayout, _NotAvailData, _Loader, cvBtnSave },
                        VerticalOptions = LayoutOptions.FillAndExpand,
                    },
                },
                BackgroundColor = LayoutHelper.PageBackgroundColor
            };

            Content = new ScrollView
            {
                Content = slViewAttendance,
            };
        }
Exemplo n.º 19
0
        /// <summary>
        /// View Attendance Layout.
        /// </summary>
        public void ViewAttendanceLayout()
        {
            TitleBar    lblPageName = new TitleBar("View Attendance");
            StackLayout slTitle     = new StackLayout
            {
                Orientation     = StackOrientation.Horizontal,
                Padding         = new Thickness(0, 5, 0, 0),
                BackgroundColor = Color.White,
                Children        = { lblPageName }
            };

            Seperator spTitle = new Seperator();

            Label lblIsAbsent = new Label
            {
                TextColor = Color.Black
            };

            Image imgLeftarrow = new Image
            {
                Source = Constants.ImagePath.ArrowLeft
            };


            Image imgStartDateDropDown = new Image {
                Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand
            };
            Label lblCurrentDate = new Label {
                TextColor = Color.Black
            };

            lblCurrentDate.Text = DateTime.Now.ToString("dd-MM-yy");//Convert.ToDateTime("07-01-2015").ToString("dd-MM-yy");
            DatePicker dtStartDate = new DatePicker {
                IsVisible = false, Date = DateTime.Today
            };

            StackLayout slStartDateDisplay = new StackLayout {
                Children = { lblCurrentDate, dtStartDate, imgStartDateDropDown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 10, 0), Device.OnPlatform(0, 5, 0))
            };

            //Frame layout for start date
            Frame frmStartDate = new Frame
            {
                Content           = slStartDateDisplay,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                OutlineColor      = Color.Black,
                Padding           = new Thickness(10)
            };

            var currentDateTap = new TapGestureRecognizer();

            currentDateTap.NumberOfTapsRequired = 1; // single-tap
            currentDateTap.Tapped += (s, e) =>
            {
                dtStartDate.Focus();
            };
            frmStartDate.GestureRecognizers.Add(currentDateTap);
            slStartDateDisplay.GestureRecognizers.Add(currentDateTap);

            StackLayout slStartDateFrmaeLayout = new StackLayout
            {
                Children = { frmStartDate }
            };

            StackLayout slStartDateLayout = new StackLayout
            {
                Children          = { slStartDateFrmaeLayout },
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            Image imgRightarrow = new Image
            {
                Source = Constants.ImagePath.ArrowRight
            };

            StackLayout slLeftArrow = new StackLayout
            {
                Children        = { imgLeftarrow },
                VerticalOptions = LayoutOptions.CenterAndExpand
            };

            StackLayout slRightArrow = new StackLayout
            {
                Children        = { imgRightarrow },
                VerticalOptions = LayoutOptions.CenterAndExpand
            };

            StackLayout slSearchLayout = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                Padding     = new Thickness(0, 0, 0, 10),
                Children    = { imgLeftarrow, slStartDateLayout, imgRightarrow }
            };

            _NotAvailData = new Label {
                Text = "No data availalble for this search data.", TextColor = Color.Red, IsVisible = false
            };

            _Loader = new LoadingIndicator();

            //List view
            StudentAttendanceListView = new ListView
            {
                RowHeight      = 50,
                SeparatorColor = Color.Gray
            };

            StudentAttendanceListView.ItemsSource  = Items;
            StudentAttendanceListView.ItemTemplate = new DataTemplate(() => new ViewAttendanceCell());

            //Grid Header Layout
            Label lblStudent = new Label
            {
                Text      = "Student",
                TextColor = Color.Black
            };

            StackLayout slStudentName = new StackLayout
            {
                Children          = { lblStudent },
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.StartAndExpand
            };

            Label lblIsPresent = new Label
            {
                Text      = "A/P",
                TextColor = Color.Black
            };

            StackLayout slIsPresent = new StackLayout
            {
                Children          = { lblIsPresent },
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.EndAndExpand
            };

            grid = new StackLayout
            {
                Children    = { slStudentName, slIsPresent },
                Orientation = StackOrientation.Horizontal,
                IsVisible   = false
            };

            spDisplayHeader = new Seperator {
                IsVisible = false
            };

            dtStartDate.DateSelected += (s, e) =>
            {
                lblCurrentDate.Text = (dtStartDate).Date.ToString("dd-MM-yy");

                _DateCounter = (dtStartDate).Date.ConvetDatetoDateCounter();

                startDateCounter = _DateCounter;
                endDateCounter   = _DateCounter + 30;

                LoadData(startDateCounter, endDateCounter);
            };

            //Left button click

            var leftArrowTap = new TapGestureRecognizer();

            leftArrowTap.NumberOfTapsRequired = 1; // single-tap
            leftArrowTap.Tapped += (s, e) =>
            {
                _DateCounter        = _DateCounter - 1;
                lblCurrentDate.Text = _DateCounter.GetDateFromDateCount().ToString("dd-MM-yy");
                dtStartDate.Date    = _DateCounter.GetDateFromDateCount();

                startDateCounter = _DateCounter;
                endDateCounter   = _DateCounter + 30;

                LoadData(startDateCounter, endDateCounter);
            };
            imgLeftarrow.GestureRecognizers.Add(leftArrowTap);

            //Right button click

            var rightArrowTap = new TapGestureRecognizer();

            rightArrowTap.NumberOfTapsRequired = 1; // single-tap
            rightArrowTap.Tapped += (s, e) =>
            {
                _DateCounter        = _DateCounter + 1;
                lblCurrentDate.Text = _DateCounter.GetDateFromDateCount().ToString("dd-MM-yy");
                dtStartDate.Date    = _DateCounter.GetDateFromDateCount();

                startDateCounter = _DateCounter;
                endDateCounter   = _DateCounter + 30;

                LoadData(startDateCounter, endDateCounter);
            };
            imgRightarrow.GestureRecognizers.Add(rightArrowTap);

            StackLayout slViewAttendance = new StackLayout
            {
                Children =
                {
                    new StackLayout {
                        Padding         = new Thickness(20, Device.OnPlatform(40, 20, 0), 20, 20),
                        Children        = { slTitle, spTitle.LineSeperatorView, slSearchLayout, _Loader, _NotAvailData, grid, spDisplayHeader.LineSeperatorView, StudentAttendanceListView },
                        VerticalOptions = LayoutOptions.FillAndExpand,
                    },
                },
                BackgroundColor = LayoutHelper.PageBackgroundColor
            };

            Content = new ScrollView
            {
                Content = slViewAttendance,
            };
        }
Exemplo n.º 20
0
        public override void InitWindow()
        {
            SetParameters(nameof(MainWindow), nameof(MainWindow), 1240, 750, false);
            IsCentered = true;

            var icon = new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream("SimpleImageViewer.Resources.icon.png"));

            TitleBar title = new TitleBar("Simple Image Viewer - C#");

            title.SetIcon(icon, 24, 24);
            title.SetPadding(4, 0, 5, 0);

            Frame layout = new Frame();

            layout.SetMargin(0, title.GetHeight(), 0, 0);
            layout.SetPadding(0, 0, 0, 0);
            layout.SetSpacing(6);
            layout.SetBackground(60, 60, 60);

            VerticalStack vToolbar = new VerticalStack();

            vToolbar.SetWidthPolicy(SizePolicy.Fixed);
            vToolbar.SetWidth(30);
            vToolbar.SetBackground(32, 32, 32);
            vToolbar.SetPadding(0, 30, 0, 0);

            HorizontalSplitArea splitArea = new HorizontalSplitArea();

            splitArea.SetMargin(vToolbar.GetWidth(), 0, 0, 0);
            splitArea.SetSplitThickness(5);

            imageArea = new WrapGrid(160, 120, Orientation.Horizontal);
            imageArea.SetBackground(Color.Transparent);
            imageArea.SetPadding(15, 6, 6, 6);
            imageArea.GetArea().SetSpacing(6, 6);
            imageArea.VScrollBar.SetStyle(Style.GetSimpleVerticalScrollBarStyle());
            imageArea.SetStretch(true);

            previewArea = new PreviewArea(imageArea);

            side = new AlbumSideList(this, Side.Left, imageArea, previewArea);
            side.SetAreaSize(400);
            Album defaultAlbum = new Album("MyPictures", Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + Path.DirectorySeparatorChar + "Pictures");

            defaultAlbum.OnDoubleClick += (sender) =>
            {
                side.Hide();
                Model.FillImageArea(this, imageArea, previewArea, (sender as Album).GetPath());
            };
            side.AddAlbum(defaultAlbum);

            ButtonCore btnSideAreaShow = new ButtonCore();

            btnSideAreaShow.SetStyle(CustomStyles.GetButtonStyle());

            ButtonCore btnOpenFolder = new ButtonCore();

            btnOpenFolder.SetStyle(CustomStyles.GetButtonStyle());

            ButtonCore btnAddAlbum = new ButtonCore();

            btnAddAlbum.SetStyle(CustomStyles.GetButtonStyle());

            //adding
            AddItems(
                title,
                layout
                );
            layout.AddItems(
                vToolbar,
                splitArea
                );

            splitArea.AssignTopItem(previewArea);
            splitArea.AssignBottomItem(imageArea);
            splitArea.SetSplitPosition(300);

            vToolbar.AddItems(
                btnSideAreaShow,
                btnOpenFolder,
                btnAddAlbum
                );

            btnSideAreaShow.AddItem(new ImageItem(DefaultsService.GetDefaultImage(EmbeddedImage.Lines, EmbeddedImageSize.Size32x32), false));
            btnOpenFolder.AddItem(new ImageItem(DefaultsService.GetDefaultImage(EmbeddedImage.Folder, EmbeddedImageSize.Size32x32), false));
            btnAddAlbum.AddItem(new ImageItem(DefaultsService.GetDefaultImage(EmbeddedImage.Import, EmbeddedImageSize.Size32x32), false));

            //events
            EventDrop += (sender, args) =>
            {
                if (side.IsHide)
                {
                    if (File.GetAttributes(args.Paths[0]).HasFlag(FileAttributes.Directory))
                    {
                        Model.FillImageArea(this, imageArea, previewArea, args.Paths[0]);
                    }
                }
                else
                {
                    foreach (String path in args.Paths)
                    {
                        if (File.GetAttributes(path).HasFlag(FileAttributes.Directory))
                        {
                            Album album = new Album(new DirectoryInfo(path).Name, path);
                            side.AddAlbum(album);
                            album.OnDoubleClick += (s) =>
                            {
                                side.Hide();
                                Model.FillImageArea(this, imageArea, previewArea, (s as Album).GetPath());
                            };
                        }
                    }
                }
            };

            btnSideAreaShow.EventMouseClick += (sender, args) =>
            {
                side.Show();
            };

            btnOpenFolder.EventMouseClick += (sender, args) =>
            {
                OpenEntryDialog browse = new OpenEntryDialog("Open Folder:", FileSystemEntryType.Directory, OpenDialogType.Open);
                browse.OnCloseDialog += () =>
                {
                    Model.FillImageArea(this, imageArea, previewArea, browse.GetResult());
                };
                browse.Show(this);
            };

            imageArea.EventScrollUp += (sender, args) =>
            {
                if (args.Mods.HasFlag(KeyMods.Control))
                {
                    int w = imageArea.GetCellWidth() + 8;
                    int h = imageArea.GetCellHeight() + 6;
                    if (w > 400)
                    {
                        return;
                    }
                    imageArea.SetCellSize(w, h);
                }
            };
            imageArea.EventScrollDown += (sender, args) =>
            {
                if (args.Mods.HasFlag(KeyMods.Control))
                {
                    int w = imageArea.GetCellWidth() - 8;
                    int h = imageArea.GetCellHeight() - 6;
                    if (w < 160)
                    {
                        return;
                    }
                    imageArea.SetCellSize(w, h);
                }
            };

            btnAddAlbum.EventMouseClick += (sender, args) =>
            {
                OpenEntryDialog browse = new OpenEntryDialog("Open Folder:", FileSystemEntryType.Directory, OpenDialogType.Open);
                browse.OnCloseDialog += () =>
                {
                    if (browse.GetResult() == null || browse.GetResult() == String.Empty)
                    {
                        return;
                    }

                    Album album = new Album(new DirectoryInfo(browse.GetResult()).Name, browse.GetResult());
                    side.AddAlbum(album);
                    album.OnDoubleClick += (s) =>
                    {
                        side.Hide();
                        Model.FillImageArea(this, imageArea, previewArea, (s as Album).GetPath());
                    };
                };
                browse.Show(this);
            };

            EventOnStart += () =>
            {
                Model.FillImageArea(this, imageArea, previewArea,
                                    Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + Path.DirectorySeparatorChar + "Pictures");
            }
        }
Exemplo n.º 21
0
        /// <summary>
        /// Todays Timetable
        /// </summary>
        public void TodaysTimetableLayout()
        {
            try
            {
                TitleBar lblPageName = new TitleBar("Today's TimeTable");
                StackLayout slTitle = new StackLayout
                {
                    Orientation = StackOrientation.Horizontal,
                    Padding = new Thickness(0, 5, 0, 0),
                    BackgroundColor = Color.White,
                    Children = { lblPageName }
                };

                Seperator spTitle = new Seperator();

                BindableRadioGroup radByTeacherOrClass = new BindableRadioGroup();

                radByTeacherOrClass.ItemsSource = new[] { "By Teacher", "By Class" };
                radByTeacherOrClass.HorizontalOptions = LayoutOptions.FillAndExpand;
                radByTeacherOrClass.Orientation = StackOrientation.Horizontal;
                radByTeacherOrClass.TextColor = Color.Black;

                StackLayout slRadio = new StackLayout
                {
                    Children = { radByTeacherOrClass },
                    HorizontalOptions = LayoutOptions.FillAndExpand
                };

                #region By Teacher

                Image imgTeacherDropDown = new Image { Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand };
                Label lblTeacher = new Label { TextColor = Color.Black, Text = "Teacher" };
                Picker pcrTeacher = new Picker { IsVisible = false, Title = "Teacher" };

                StackLayout slTeacherDisplay = new StackLayout { Children = { lblTeacher, pcrTeacher, imgTeacherDropDown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 10, 0), Device.OnPlatform(0, 5, 0)) };

                Frame frmTeacher = new Frame
                {
                    Content = slTeacherDisplay,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    OutlineColor = Color.Black,
                    Padding = new Thickness(10)
                };

                var teacherTap = new TapGestureRecognizer();

                teacherTap.NumberOfTapsRequired = 1; // single-tap
                teacherTap.Tapped += (s, e) =>
                {
                    pcrTeacher.Focus();
                };
                frmTeacher.GestureRecognizers.Add(teacherTap);
                slTeacherDisplay.GestureRecognizers.Add(teacherTap);

                StackLayout slTeacherFrameLayout = new StackLayout
                {
                    Children = { frmTeacher }
                };

                StackLayout slTeacherLayout = new StackLayout
                {
                    Children = { slTeacherFrameLayout },
                    Orientation = StackOrientation.Vertical,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    IsVisible = false
                };

                Label lblStandardName = new Label
                {
                    Text = "Standard Name",
                    TextColor = Color.Black
                };

                StackLayout slStandardName = new StackLayout
                {
                    Children = { lblStandardName },
                    VerticalOptions = LayoutOptions.CenterAndExpand,
                };

                Label lblClassTypeName = new Label
                {
                    Text = "Class Type Name",
                    TextColor = Color.Black
                };

                StackLayout slClassTypeName = new StackLayout
                {
                    Children = { lblClassTypeName },
                    VerticalOptions = LayoutOptions.CenterAndExpand,
                    HorizontalOptions = LayoutOptions.CenterAndExpand
                };

                Label lblStubjectName = new Label
                {
                    Text = "Subject Name",
                    TextColor = Color.Black
                };

                StackLayout slSubjectName = new StackLayout
                {
                    Children = { lblStubjectName },
                    VerticalOptions = LayoutOptions.CenterAndExpand,
                    HorizontalOptions = LayoutOptions.EndAndExpand
                };
                #endregion

                #region By Class

                Image imgStandardDropDown = new Image { Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand };
                Label lblStandard = new Label { TextColor = Color.Black, Text = "Standard" };
                Picker pcrStandard = new Picker { IsVisible = false, Title = "Standard" };

                StackLayout slStandardDisplay = new StackLayout { Children = { lblStandard, pcrStandard, imgStandardDropDown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 10, 0), Device.OnPlatform(0, 5, 0)) };

                Frame frmStandard = new Frame
                {
                    Content = slStandardDisplay,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    OutlineColor = Color.Black,
                    Padding = new Thickness(10)
                };

                var standardTap = new TapGestureRecognizer();

                standardTap.NumberOfTapsRequired = 1; // single-tap
                standardTap.Tapped += (s, e) =>
                {
                    pcrStandard.Focus();
                };
                frmStandard.GestureRecognizers.Add(standardTap);
                slStandardDisplay.GestureRecognizers.Add(standardTap);

                StackLayout slStandardFrameLayout = new StackLayout
                {
                    Children = { frmStandard }
                };

                StackLayout slStandardLayout = new StackLayout
                {
                    Children = { slStandardFrameLayout },
                    Orientation = StackOrientation.Vertical,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                };

                Image imgClassDropDown = new Image { Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand };
                Label lblClass = new Label { TextColor = Color.Black, Text = "Class" };
                Picker pcrClass = new Picker { IsVisible = false, Title = "Class" };

                StackLayout slClassDisplay = new StackLayout { Children = { lblClass, pcrClass, imgClassDropDown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 10, 0), Device.OnPlatform(0, 5, 0)) };

                Frame frmClass = new Frame
                {
                    Content = slClassDisplay,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    OutlineColor = Color.Black,
                    Padding = new Thickness(10)
                };

                var classTap = new TapGestureRecognizer();

                classTap.NumberOfTapsRequired = 1; // single-tap
                classTap.Tapped += (s, e) =>
                {
                    pcrClass.Focus();
                };
                frmClass.GestureRecognizers.Add(classTap);
                slClassDisplay.GestureRecognizers.Add(classTap);

                StackLayout slClassFrameLayout = new StackLayout
                {
                    Children = { frmClass }
                };

                StackLayout slClassLayout = new StackLayout
                {
                    Children = { slClassFrameLayout },
                    Orientation = StackOrientation.Vertical,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    IsVisible = false
                };

                //Grid Header
                Label lblTeachername = new Label
                {
                    Text = "Teacher Name",
                    TextColor = Color.Black
                };

                StackLayout slTeacherName = new StackLayout
                {
                    Children = { lblTeachername },
                    VerticalOptions = LayoutOptions.CenterAndExpand,
                    HorizontalOptions = LayoutOptions.CenterAndExpand
                };

                Label lblStubject = new Label
                {
                    Text = "Subject Name",
                    TextColor = Color.Black
                };

                StackLayout slSubject = new StackLayout
                {
                    Children = { lblStubject },
                    VerticalOptions = LayoutOptions.CenterAndExpand,
                    HorizontalOptions = LayoutOptions.EndAndExpand
                };

                #endregion

                Label lblSequensNo = new Label
                {
                    Text = "No",
                    TextColor = Color.Black
                };

                StackLayout slSequensNo = new StackLayout
                {
                    Children = { lblSequensNo },
                    VerticalOptions = LayoutOptions.CenterAndExpand,
                    HorizontalOptions = LayoutOptions.StartAndExpand
                };

                StackLayout grid = new StackLayout
                {
                    //Children = { slTeacherName, slSequensNo, slSubjectName },
                    Orientation = StackOrientation.Horizontal,
                    IsVisible = false
                };

                Seperator spDisplayHeader = new Seperator { IsVisible = false };

                StackLayout slSearchinOneCol = new StackLayout
                {
                    Children = { slStandardLayout, slClassLayout },
                    Orientation = StackOrientation.Horizontal,
                    IsVisible = false
                };

                _NotAvailData = new Label { Text = "No data availalble for this search data.", TextColor = Color.Red, IsVisible = false };

                _Loader = new LoadingIndicator();

                radByTeacherOrClass.CheckedChanged += (sender, e) =>
                    {
                        Device.BeginInvokeOnMainThread(async () =>
                       {
                           var radio = sender as CustomRadioButton;

                           if (radio == null || radio.Id == -1)
                           {
                               return;
                           }

                           if (radio.Text == "By Teacher")
                           {
                               slTeacherLayout.IsVisible = true;
                               slSearchinOneCol.IsVisible = false;

                               foreach (TeacherModel item in _TeacherList)
                               {
                                   pcrTeacher.Items.Add(item.Name);
                               }

                               grid.Children.Add(slSequensNo);
                               grid.Children.Add(slStandardDisplay);
                               grid.Children.Add(slClassTypeName);
                               grid.Children.Add(slSubjectName);

                           }
                           else
                           {
                               slSearchinOneCol.IsVisible = true;
                               slTeacherLayout.IsVisible = false;

                               grid.Children.Add(slSequensNo);
                               grid.Children.Add(slTeacherName);
                               grid.Children.Add(slSubject);

                               _StatndardList = await StandardModel.GetStandard();

                               foreach (StandardModel item in _StatndardList)
                               {
                                   pcrStandard.Items.Add(item.Name);
                               }
                           }
                       });
                    };

                //List view
                ListView TimeTableListView = new ListView
                {
                    RowHeight = 50,
                    SeparatorColor = Color.Gray
                };

                TimeTableListView.ItemTemplate = new DataTemplate(() => new FillUpAttendanceCell());

                pcrStandard.SelectedIndexChanged += (sender, e) =>
                {
                    Device.BeginInvokeOnMainThread(async () =>
                    {
                        try
                        {
                            _Loader.IsShowLoading = true;
                            pcrClass.Items.Clear();

                            string standardName = lblStandard.Text = pcrStandard.Items[pcrStandard.SelectedIndex];

                            _SelectedStandardID = _StatndardList.Where(x => x.Name == standardName).FirstOrDefault().Id;

                            _ClassTypeList = await ClassTypeModel.GetClassType(_SelectedStandardID);

                            if (_ClassTypeList.Count > 0 && _ClassTypeList != null)
                            {
                                slClassLayout.IsVisible = true;
                                _NotAvailData.IsVisible = false;
                            }
                            else
                            {
                                slClassLayout.IsVisible = false;
                                _NotAvailData.IsVisible = true;
                            }

                            foreach (ClassTypeModel item in _ClassTypeList)
                            {
                                pcrClass.Items.Add(item.Name);
                            }

                            _Loader.IsShowLoading = false;
                        }
                        catch (Exception ex)
                        {

                        }
                    });
                };

                //Class Picker Selected

                pcrClass.SelectedIndexChanged += (sender, e) =>
                {
                    Device.BeginInvokeOnMainThread(async () =>
                    {
                        _Loader.IsShowLoading = true;
                        _NotAvailData.IsVisible = false;

                        string className = lblClass.Text = pcrClass.Items[pcrClass.SelectedIndex];

                        _SelectedClassTypeID = _ClassTypeList.FirstOrDefault(x => x.Name == className).Id;

                        //Get time table list
                        _TimeTableList = await TimeTableModel.ShowTimeTable(_SelectedStandardID, _SelectedClassTypeID);

                        if (_TimeTableList != null && _TimeTableList.Count > 0)
                        {
                            grid.IsVisible = true;
                            spDisplayHeader.IsVisible = true;
                            Items = new ObservableCollection<TimeTableModel>(_TimeTableList);
                            TimeTableListView.ItemsSource = Items;
                        }
                        else
                        {
                            grid.IsVisible = false;
                            spDisplayHeader.IsVisible = false;
                            _NotAvailData.Text = "There is no data for selected standard and class.";
                            _NotAvailData.IsVisible = true;
                        }
                        _Loader.IsShowLoading = false;
                    });
                };

                //Class Picker Selected

                pcrTeacher.SelectedIndexChanged += (sender, e) =>
                {
                    Device.BeginInvokeOnMainThread(async () =>
                    {
                        _Loader.IsShowLoading = true;
                        _NotAvailData.IsVisible = false;

                        string teacherName = lblTeacher.Text = pcrTeacher.Items[pcrTeacher.SelectedIndex];

                        _SelectedTeacherID = _TeacherList.FirstOrDefault(x => x.Name == teacherName).ID;

                        //Get time table list
                        _TimeTableList = await TimeTableModel.ShowTimeTable(_SelectedTeacherID);

                        if (_TimeTableList != null && _TimeTableList.Count > 0)
                        {
                            grid.IsVisible = true;
                            spDisplayHeader.IsVisible = true;
                            Items = new ObservableCollection<TimeTableModel>(_TimeTableList);
                            TimeTableListView.ItemsSource = Items;
                        }
                        else
                        {
                            grid.IsVisible = false;
                            spDisplayHeader.IsVisible = false;
                            _NotAvailData.Text = "There is no data for selected standard and class.";
                            _NotAvailData.IsVisible = true;
                        }
                        _Loader.IsShowLoading = false;
                    });
                };

                StackLayout slTimeTable = new StackLayout
                {
                    Children = { 
                        new StackLayout{
                            Padding = new Thickness(20, Device.OnPlatform(40,20,0), 20, 20),
						    Children = {slTitle, spTitle.LineSeperatorView,slRadio,slTeacherLayout, slSearchinOneCol,grid,spDisplayHeader.LineSeperatorView, _Loader, _NotAvailData,TimeTableListView},
                            VerticalOptions = LayoutOptions.FillAndExpand,
                        },
                    },
                    BackgroundColor = LayoutHelper.PageBackgroundColor
                };

                Content = new ScrollView
                {
                    Content = slTimeTable,
                };
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Exemplo n.º 22
0
        public MainPage()
            : base(typeof(MainViewModel), typeof(MainContentUI),
                   Device.Idiom == TargetIdiom.Phone ? PanelSetEnum.psLeftRight : PanelSetEnum.psRight)
        {
            BackgroundColor = MainStyles.ListBackgroundColor.FromResources <Color>();

            appBar = new TitleBar(this, TitleBar.BarBtnEnum.bbLeftRight, TitleBar.BarAlignEnum.baBottom)
            {
                BarColor = Color.Transparent,
                BtnRight =
                {
                    Source = contentUI.IconMenuSideBar
                }
            };

            appBar.BtnRight.Click += viewModel.AppBar_BtnRightClick;

            MapLocation = new MapTile
            {
                HasScrollEnabled = true,
                HasZoomEnabled   = true,
                Context          = contentUI
            };

            MapLocation.ClickPinDetail += viewModel.MapLocation_ClickPinDetail;

            mainLayout = new RelativeLayout();
            mainLayout.Children.Add(MapLocation.MapLayout,
                                    Constraint.Constant(0),
                                    Constraint.Constant(0),
                                    Constraint.RelativeToParent(parent => parent.Width),
                                    Constraint.RelativeToParent(parent => parent.Height));

            mainLayout.Children.Add(appBar,
                                    Constraint.Constant(0),
                                    Constraint.RelativeToParent(
                                        parent => parent.Height - appBar.HeightBar - appBar.Margin.VerticalThickness),
                                    Constraint.RelativeToParent(parent => parent.Width));

            PanelChanged += (sender, args) =>
            {
                if (args.IsShow)
                {
                    MapLocation.CloseDetailInfo();
                }
            };

            InitPanelsAndLayout();

            var safeAreaHelper = new SafeAreaHelper();

            safeAreaHelper.UseSafeArea(this, SafeAreaHelper.CustomSafeAreaFlags.None);
            safeAreaHelper.UseSafeArea(appBar,
                                       SafeAreaHelper.CustomSafeAreaFlags.Horizontal | SafeAreaHelper.CustomSafeAreaFlags.Bottom);
            safeAreaHelper.UseSafeArea(RightPanel.Content,
                                       SafeAreaHelper.CustomSafeAreaFlags.Top | SafeAreaHelper.CustomSafeAreaFlags.Right);
            if (LeftPanel != null)
            {
                safeAreaHelper.UseSafeArea(LeftPanel.Content,
                                           SafeAreaHelper.CustomSafeAreaFlags.Top | SafeAreaHelper.CustomSafeAreaFlags.Left);
            }
            if (btnLocation != null)
            {
                safeAreaHelper.UseSafeArea(btnLocation, SafeAreaHelper.CustomSafeAreaFlags.Left);
            }
            if (Device.RuntimePlatform == Device.Android)
            {
                safeAreaHelper.UseSafeArea(MapLocation.MapPinDetail, SafeAreaHelper.CustomSafeAreaFlags.All);
            }

            ContentLayout.Children.Add(mainLayout);
        }
Exemplo n.º 23
0
        /// <summary>Creates a new exception tree. Currently, only one is used.</summary>
        /// <param name="list">The list.</param>
        /// <returns>An exception tree</returns>
        public ExceptionTree CreateExceptionTree(IEnumerable<ThrownException> list)
        {
            if (this.exceptionTree != null)
            {
                return this.exceptionTree;
            }

            ExceptionTree tree = new ExceptionTree();
            CallStackList callStackList = new CallStackList();
            TitleBar treeTitle = new TitleBar();
            TitleBar callStackTitle = new TitleBar();
            SplitContainer split = new SplitContainer();

            tree.SuspendLayout();
            callStackList.SuspendLayout();
            treeTitle.SuspendLayout();
            callStackTitle.SuspendLayout();
            split.SuspendLayout();

            tree.CallStackList = callStackList;

            int titleHeight = 18;
            int width = this.splitContainerMaster.Panel1.ClientRectangle.Width;

            //treeTitle.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
            treeTitle.Dock = DockStyle.Top;
            treeTitle.BackColor = System.Drawing.SystemColors.Control;
            treeTitle.Font = new System.Drawing.Font("Segoe UI", 9F);
            //treeTitle.Location = new System.Drawing.Point(0, this.exceptionTabStrip.Height);
            treeTitle.Name = "exceptionTreeTitle";
            treeTitle.Size = new System.Drawing.Size(width, titleHeight);
            treeTitle.TabIndex = 1;
            treeTitle.Text = "Exception Tree";
            treeTitle.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;

            tree.BackColor = System.Drawing.SystemColors.Window;
            tree.Controller = null;
            tree.Dock = System.Windows.Forms.DockStyle.Fill;
            tree.FullRowSelect = true;
            tree.Location = new System.Drawing.Point(0, titleHeight);
            tree.Margin = new System.Windows.Forms.Padding(0);
            tree.Name = "exceptionTree";
            tree.ImageList = this.classTree.ImageList;
            tree.Size = new System.Drawing.Size(558, 154);
            tree.TabIndex = 2;

            callStackTitle.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
            callStackTitle.BackColor = System.Drawing.SystemColors.Control;
            callStackTitle.Font = new System.Drawing.Font("Segoe UI", 9F);
            callStackTitle.Location = new System.Drawing.Point(0, 0);
            callStackTitle.Name = "callStackTitle";
            callStackTitle.Size = new System.Drawing.Size(width, titleHeight);
            callStackTitle.TabIndex = 1;
            callStackTitle.Text = "Call stack";
            callStackTitle.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;

            callStackList.BackColor = System.Drawing.SystemColors.Window;
            callStackList.Controller = null;
            callStackList.Dock = System.Windows.Forms.DockStyle.Fill;
            callStackList.FullRowSelect = true;
            callStackList.GroupByType = false;
            callStackList.Location = new System.Drawing.Point(0, titleHeight);
            callStackList.Margin = new System.Windows.Forms.Padding(0);
            callStackList.Name = "callStackList";
            callStackList.OwnerDraw = true;
            callStackList.Size = new System.Drawing.Size(width, 154);
            callStackList.SmallImageList = this.images;
            callStackList.TabIndex = 2;
            callStackList.UseCompatibleStateImageBehavior = false;
            callStackList.View = System.Windows.Forms.View.Details;

            split.Name = "splitExceptions";
            split.Orientation = System.Windows.Forms.Orientation.Horizontal;

            //split.Location = new System.Drawing.Point(0, this.exceptionTabStrip.Size.Height);
            //split.Size = new System.Drawing.Size(100, this.exceptionTabStrip.ClientRectangle.Height);

            split.Panel1.Controls.Add(treeTitle);
            split.Panel1.Controls.Add(tree);
            split.Panel1.Padding = new System.Windows.Forms.Padding(0, titleHeight , 0, 0);

            split.Panel2.Controls.Add(callStackTitle);
            split.Panel2.Controls.Add(callStackList);
            split.Panel2.Padding = new System.Windows.Forms.Padding(0, titleHeight, 0, 0);

            //split.Size = new System.Drawing.Size(558, 298);
            split.SplitterDistance = 122;
            split.TabIndex = 5;

            split.Dock = DockStyle.Fill;

            this.splitContainerMaster.Panel2.Controls.Add(split);
            ////this.tablePanel.Controls.Add(split, 0, 1);
            ////this.exceptionTabStrip.ActiveTab = this.exceptionTabStrip.AddTab("hello", split);

            split.Margin = new System.Windows.Forms.Padding(0);

            tree.ResumeLayout();
            callStackList.ResumeLayout();
            treeTitle.ResumeLayout();
            callStackTitle.ResumeLayout();
            split.ResumeLayout();

            this.exceptionTreeTitle = treeTitle;
            this.callStackListTitle = callStackTitle;

            return tree;
        }
Exemplo n.º 24
0
        /// <summary>
        /// Student BehaviourNotice Layout.
        /// </summary>
        public void StudentBehaviourLayout()
        {
            TitleBar    lblPageName = new TitleBar("Student Behaviour Notice");
            StackLayout slTitle     = new StackLayout
            {
                Orientation     = StackOrientation.Horizontal,
                Padding         = new Thickness(0, 5, 0, 0),
                BackgroundColor = Color.White,
                Children        = { lblPageName }
            };

            Seperator spTitle = new Seperator();

            Image imgStandardDropDown = new Image {
                Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand
            };
            Label lblStandard = new Label {
                TextColor = Color.Black, Text = "Standard"
            };
            Picker pcrStandard = new Picker {
                IsVisible = false, Title = "Standard"
            };

            foreach (StandardModel item in _StandardList)
            {
                pcrStandard.Items.Add(item.Name);
            }

            StackLayout slStandardDisplay = new StackLayout {
                Children = { lblStandard, pcrStandard, imgStandardDropDown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 10, 0), Device.OnPlatform(0, 5, 0))
            };

            Frame frmStandard = new Frame
            {
                Content           = slStandardDisplay,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                OutlineColor      = Color.Black,
                Padding           = new Thickness(10)
            };

            var standardTap = new TapGestureRecognizer();

            standardTap.NumberOfTapsRequired = 1; // single-tap
            standardTap.Tapped += (s, e) =>
            {
                pcrStandard.Focus();
            };
            frmStandard.GestureRecognizers.Add(standardTap);
            slStandardDisplay.GestureRecognizers.Add(standardTap);

            StackLayout slStandardFrameLayout = new StackLayout
            {
                Children = { frmStandard }
            };

            StackLayout slStandardLayout = new StackLayout
            {
                Children          = { slStandardFrameLayout },
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            Image imgClassDropDown = new Image {
                Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand
            };
            Label lblClass = new Label {
                TextColor = Color.Black, Text = "Class"
            };
            Picker pcrClass = new Picker {
                IsVisible = false, Title = "Class"
            };

            StackLayout slClassDisplay = new StackLayout {
                Children = { lblClass, pcrClass, imgClassDropDown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 10, 0), Device.OnPlatform(0, 5, 0))
            };

            Frame frmClass = new Frame
            {
                Content           = slClassDisplay,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                OutlineColor      = Color.Black,
                Padding           = new Thickness(10)
            };

            var classTap = new TapGestureRecognizer();

            classTap.NumberOfTapsRequired = 1; // single-tap
            classTap.Tapped += (s, e) =>
            {
                pcrClass.Focus();
            };
            frmClass.GestureRecognizers.Add(classTap);
            slClassDisplay.GestureRecognizers.Add(classTap);

            StackLayout slClassFrmaeLayout = new StackLayout
            {
                Children = { frmClass }
            };

            StackLayout slClassLayout = new StackLayout
            {
                Children          = { slClassFrmaeLayout },
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                IsVisible         = false
            };

            Image imgStudentNameDropDown = new Image {
                Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand
            };
            Label lblStudentName = new Label {
                TextColor = Color.Black, Text = "Student Name"
            };
            Picker pcrStudentName = new Picker {
                IsVisible = false, Title = "Student Name"
            };

            StackLayout slStudentNameDisplay = new StackLayout {
                Children = { lblStudentName, pcrStudentName, imgStudentNameDropDown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 10, 0), Device.OnPlatform(0, 5, 0))
            };

            Frame frmStudentName = new Frame
            {
                Content           = slStudentNameDisplay,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                OutlineColor      = Color.Black,
                Padding           = new Thickness(10)
            };

            var studentNameTap = new TapGestureRecognizer();

            studentNameTap.NumberOfTapsRequired = 1; // single-tap
            studentNameTap.Tapped += (s, e) =>
            {
                pcrStudentName.Focus();
            };
            frmStudentName.GestureRecognizers.Add(studentNameTap);
            slStudentNameDisplay.GestureRecognizers.Add(studentNameTap);

            StackLayout slStudentNameFrmaeLayout = new StackLayout
            {
                Children = { frmStudentName }
            };

            StackLayout slStudentNameLayout = new StackLayout
            {
                Children          = { slStudentNameFrmaeLayout },
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                IsVisible         = false
            };

            //ExtendedEntry txtComment = new ExtendedEntry
            //{
            //    Placeholder = "Comment",
            //    TextColor = Color.Black
            //};

            Label lblComment = new Label
            {
                Text      = "Comment",
                TextColor = Color.Black
            };

            StackLayout slLableComment = new StackLayout
            {
                Children = { lblComment },
                Padding  = new Thickness(0, 0, 0, 10)
            };

            Editor txtComment = new Editor
            {
                HeightRequest   = 80,
                VerticalOptions = LayoutOptions.FillAndExpand
            };

            StackLayout slTextComment = new StackLayout
            {
                Children = { txtComment },
                Padding  = new Thickness(0, 0, 0, 10)
            };

            //txtComment.Focused += (sender, e) =>
            //{
            //    if (txtComment.Text == "Comment")
            //    {
            //        txtComment.Text = string.Empty;
            //        //txtComment.TextColor = Color.Black;
            //    }
            //};

            StackLayout slComment = new StackLayout
            {
                Children          = { slLableComment, slTextComment },
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Orientation       = StackOrientation.Vertical
            };

            StackLayout slSearchinOneCol = new StackLayout
            {
                Children    = { slStandardLayout, slClassLayout },
                Orientation = StackOrientation.Horizontal
            };

            StackLayout slSearchLayout = new StackLayout
            {
                Orientation = StackOrientation.Vertical,
                Padding     = new Thickness(0, 0, 0, 10),
                Children    = { slStudentNameLayout, slComment }
            };

            _NotAvailData = new Label {
                Text = "No data availalble for this search data.", TextColor = Color.Red, IsVisible = false
            };

            _Loader = new LoadingIndicator();

            //Stanndard Picker Selected
            pcrStandard.SelectedIndexChanged += (sender, e) =>
            {
                Device.BeginInvokeOnMainThread(async() =>
                {
                    _Loader.IsShowLoading = true;
                    pcrClass.Items.Clear();
                    pcrStudentName.Items.Clear();

                    string standardName = lblStandard.Text = pcrStandard.Items[pcrStandard.SelectedIndex];

                    _SelectedStandardID = _StandardList.Where(x => x.Name == standardName).FirstOrDefault().Id;

                    _ClassTypeList = await ClassTypeModel.GetClassType(_SelectedStandardID);

                    if (_ClassTypeList.Count > 0 && _ClassTypeList != null)
                    {
                        slClassLayout.IsVisible = true;
                        _NotAvailData.IsVisible = false;
                    }
                    else
                    {
                        _NotAvailData.IsVisible = true;
                    }

                    foreach (ClassTypeModel item in _ClassTypeList)
                    {
                        pcrClass.Items.Add(item.Name);
                    }

                    _Loader.IsShowLoading = false;
                });
            };

            //Class Picker Selected

            pcrClass.SelectedIndexChanged += (sender, e) =>
            {
                Device.BeginInvokeOnMainThread(async() =>
                {
                    _Loader.IsShowLoading = true;
                    pcrStudentName.Items.Clear();

                    string className = lblClass.Text = pcrClass.Items[pcrClass.SelectedIndex];

                    _SelectedClassTypeID = _ClassTypeList.FirstOrDefault(x => x.Name == className).Id;

                    List <StudentModel> lstStudentList = await StudentModel.GetStudent(_SelectedStandardID, _SelectedClassTypeID);

                    if (lstStudentList != null && lstStudentList.Count > 0)
                    {
                        slStudentNameLayout.IsVisible = true;
                        _NotAvailData.IsVisible       = false;

                        foreach (StudentModel item in _StudentModelList)
                        {
                            pcrStudentName.Items.Add(item.Name);
                        }
                    }
                    else
                    {
                        _NotAvailData.Text      = "There is no student for this class and standard";
                        _NotAvailData.IsVisible = true;
                    }
                    _Loader.IsShowLoading = false;
                });
            };

            Button btnSave = new Button {
                IsVisible = false
            };

            btnSave.Text            = "Save";
            btnSave.TextColor       = Color.White;
            btnSave.BackgroundColor = LayoutHelper.ButtonColor;

            pcrStudentName.SelectedIndexChanged += (sender, e) =>
            {
                Device.BeginInvokeOnMainThread(async() =>
                {
                    //btnSave.IsVisible = true;
                    string studentName = lblStudentName.Text = pcrStudentName.Items[pcrStudentName.SelectedIndex];

                    _SelectedStudentID = _StudentModelList.FirstOrDefault(x => x.Name == studentName).Id;

                    //Exam list call
                    slStudentNameLayout.IsVisible = true;
                });
            };

            btnSave.Clicked += (sender, e) =>
            {
                Device.BeginInvokeOnMainThread(async() =>
                {
                    _Loader.IsShowLoading = true;

                    StudentBehaviourNoticeModel studentBehaviourNoticeModel = new StudentBehaviourNoticeModel();
                    studentBehaviourNoticeModel.ClassTypeId = _SelectedClassTypeID;
                    studentBehaviourNoticeModel.StandardId  = _SelectedStandardID;
                    studentBehaviourNoticeModel.StudentId   = _SelectedStudentID;
                    studentBehaviourNoticeModel.Comment     = txtComment.Text;

                    bool isSaveAttendance = await StudentBehaviourNoticeModel.SaveStudentBehaviour(studentBehaviourNoticeModel);

                    if (isSaveAttendance)
                    {
                        await DisplayAlert(string.Empty, "Save Successfully.", Messages.Ok);
                    }
                    else
                    {
                        await DisplayAlert(Messages.Error, "Some problem ocuured when saving data.", Messages.Ok);
                    }
                    _Loader.IsShowLoading = false;
                });
            };

            var cvBtnSave = new ContentView
            {
                Padding = new Thickness(10, 5, 10, 10),
                Content = btnSave
            };

            StackLayout slStudentBehaviourNotice = new StackLayout
            {
                Children =
                {
                    new StackLayout {
                        Padding         = new Thickness(20, Device.OnPlatform(40, 20, 0), 20, 20),
                        Children        = { slTitle, spTitle.LineSeperatorView, slSearchinOneCol, slSearchLayout, _Loader, cvBtnSave, _NotAvailData },
                        VerticalOptions = LayoutOptions.FillAndExpand,
                    },
                },
                BackgroundColor = LayoutHelper.PageBackgroundColor
            };

            Content = new ScrollView
            {
                Content = slStudentBehaviourNotice,
            };
        }
        /// <summary>
        /// View Attendance Summary Layout.
        /// </summary>
        public void ViewAttendanceSummaryLayout()
        {
            TitleBar    lblPageName = new TitleBar("View Attendance Summary");
            StackLayout slTitle     = new StackLayout
            {
                Orientation     = StackOrientation.Horizontal,
                Padding         = new Thickness(0, 5, 0, 0),
                BackgroundColor = Color.White,
                Children        = { lblPageName }
            };

            Seperator spTitle = new Seperator();

            Image imgStartDateDropDown = new Image {
                Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand
            };
            Label lblCurrentDate = new Label {
                TextColor = Color.Black, Text = "Select Month"
            };
            Picker pcrYearRange = new Picker {
                IsVisible = false, Title = "Year Range"
            };

            foreach (YearMonthModel item in _YearMonth)
            {
                pcrYearRange.Items.Add(item.Value);
            }

            StackLayout slSelectMonthDisplay = new StackLayout {
                Children = { lblCurrentDate, pcrYearRange, imgStartDateDropDown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 10, 0), Device.OnPlatform(0, 5, 0))
            };

            //Frame layout for start date
            Frame frmSelectMonth = new Frame
            {
                Content           = slSelectMonthDisplay,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                OutlineColor      = Color.Black,
                Padding           = new Thickness(10)
            };

            var dateTimePickerTap = new TapGestureRecognizer();

            dateTimePickerTap.NumberOfTapsRequired = 1; // single-tap
            dateTimePickerTap.Tapped += (s, e) =>
            {
                pcrYearRange.Focus();
            };
            frmSelectMonth.GestureRecognizers.Add(dateTimePickerTap);
            slSelectMonthDisplay.GestureRecognizers.Add(dateTimePickerTap);

            StackLayout slStartDateFrmaeLayout = new StackLayout
            {
                Children = { frmSelectMonth }
            };

            StackLayout slStartDateLayout = new StackLayout
            {
                Children          = { slStartDateFrmaeLayout },
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            StackLayout slSearchLayout = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                Padding     = new Thickness(0, 0, 0, 10),
                Children    = { slStartDateLayout }
            };

            _NotAvailData = new Label {
                Text = "No data availalble for this search data.", TextColor = Color.Red, IsVisible = false
            };

            _Loader = new LoadingIndicator();

            Label lblTotalWorkingDays = new Label
            {
                TextColor = Color.Black
            };

            StackLayout slTotalWorkingDays = new StackLayout {
                Children = { lblTotalWorkingDays }, Padding = new Thickness(0, 0, 0, 10)
            };

            Label lblTotalPresentDay = new Label
            {
                TextColor = Color.Black
            };

            StackLayout slTotalPresentDay = new StackLayout {
                Children = { lblTotalPresentDay }, Padding = new Thickness(0, 0, 0, 10)
            };

            Label lblTotalAbsentDay = new Label
            {
                TextColor = Color.Black
            };

            StackLayout slTotalAbsentDay = new StackLayout {
                Children = { lblTotalAbsentDay }, Padding = new Thickness(0, 0, 0, 10)
            };

            pcrYearRange.SelectedIndexChanged += (s, e) =>
            {
                Device.BeginInvokeOnMainThread(async() =>
                {
                    try
                    {
                        _Loader.IsShowLoading    = true;
                        lblTotalWorkingDays.Text = string.Empty;
                        lblTotalPresentDay.Text  = string.Empty;
                        lblTotalAbsentDay.Text   = string.Empty;

                        lblCurrentDate.Text = pcrYearRange.Items[pcrYearRange.SelectedIndex].ToString();

                        DateTime dt = Convert.ToDateTime("1-" + lblCurrentDate.Text);

                        int dateCounter = dt.ConvetDatetoDateCounter();

                        AttendanceSummaryModel attendanceSummary = await AttendanceSummaryModel.GetAttendanceSummary(dateCounter);

                        if (!string.IsNullOrEmpty(Convert.ToString(attendanceSummary.AbsentDays)) && !string.IsNullOrEmpty(Convert.ToString(attendanceSummary.PresentDays)) && !string.IsNullOrEmpty(Convert.ToString(attendanceSummary.TotalWorkingDays)))
                        {
                            _NotAvailData.IsVisible = false;

                            lblTotalWorkingDays.Text = "Total WorkingDays: " + attendanceSummary.TotalWorkingDays.ToString();
                            lblTotalPresentDay.Text  = "Total PresentDays: " + attendanceSummary.PresentDays.ToString();
                            lblTotalAbsentDay.Text   = "Total AbsentDays: " + attendanceSummary.AbsentDays.ToString();
                        }
                        else
                        {
                            _NotAvailData.IsVisible      = true;
                            slTotalAbsentDay.IsVisible   = false;
                            slTotalPresentDay.IsVisible  = false;
                            slTotalWorkingDays.IsVisible = false;
                        }

                        _Loader.IsShowLoading = false;
                    }
                    catch (Exception ex)
                    {
                    }
                });
            };

            StackLayout slViewAttendance = new StackLayout
            {
                Children =
                {
                    new StackLayout {
                        Padding         = new Thickness(20, Device.OnPlatform(40, 20, 0), 20, 20),
                        Children        = { slTitle, spTitle.LineSeperatorView, slSearchLayout, _Loader, _NotAvailData, slTotalWorkingDays, slTotalPresentDay, slTotalAbsentDay },
                        VerticalOptions = LayoutOptions.FillAndExpand,
                    },
                },
                BackgroundColor = LayoutHelper.PageBackgroundColor
            };

            Content = new ScrollView
            {
                Content = slViewAttendance,
            };
        }
Exemplo n.º 26
0
        /// <summary>
        /// Enter Student Mark Layout.
        /// </summary>
        public void EnterStudentMarkLayout()
        {
            TitleBar    lblPageName = new TitleBar("Enter Student Mark");
            StackLayout slTitle     = new StackLayout
            {
                Orientation     = StackOrientation.Horizontal,
                Padding         = new Thickness(0, 5, 0, 0),
                BackgroundColor = Color.White,
                Children        = { lblPageName }
            };

            Seperator spTitle = new Seperator();

            Image imgStandardDropDown = new Image {
                Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand
            };
            Label lblStandard = new Label {
                TextColor = Color.Black, Text = "Standard"
            };
            Picker pcrStandard = new Picker {
                IsVisible = false, Title = "Standard"
            };

            foreach (StandardModel item in _StandardList)
            {
                pcrStandard.Items.Add(item.Name);
            }

            StackLayout slStandardDisplay = new StackLayout {
                Children = { lblStandard, pcrStandard, imgStandardDropDown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 10, 0), Device.OnPlatform(0, 5, 0))
            };

            Frame frmStandard = new Frame
            {
                Content           = slStandardDisplay,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                OutlineColor      = Color.Black,
                Padding           = new Thickness(10)
            };

            var standardTap = new TapGestureRecognizer();

            standardTap.NumberOfTapsRequired = 1; // single-tap
            standardTap.Tapped += (s, e) =>
            {
                pcrStandard.Focus();
            };
            frmStandard.GestureRecognizers.Add(standardTap);
            slStandardDisplay.GestureRecognizers.Add(standardTap);

            StackLayout slStandardFrameLayout = new StackLayout
            {
                Children = { frmStandard }
            };

            StackLayout slStandardLayout = new StackLayout
            {
                Children          = { slStandardFrameLayout },
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            Image imgExamTypeDropDown = new Image {
                Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand
            };
            Label lblExamType = new Label {
                TextColor = Color.Black, Text = "Exam Type"
            };
            Picker pcrExamType = new Picker {
                IsVisible = false, Title = "Exam Type"
            };

            StackLayout slExamTypeDisplay = new StackLayout {
                Children = { lblExamType, pcrExamType, imgExamTypeDropDown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 10, 0), Device.OnPlatform(0, 5, 0))
            };

            Frame frmExamType = new Frame
            {
                Content           = slExamTypeDisplay,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                OutlineColor      = Color.Black,
                Padding           = new Thickness(10)
            };

            var examTypeTap = new TapGestureRecognizer();

            examTypeTap.NumberOfTapsRequired = 1; // single-tap
            examTypeTap.Tapped += (s, e) =>
            {
                pcrExamType.Focus();
            };
            frmExamType.GestureRecognizers.Add(examTypeTap);
            slExamTypeDisplay.GestureRecognizers.Add(examTypeTap);

            StackLayout slExamTypeFrmaeLayout = new StackLayout
            {
                Children = { frmExamType }
            };

            StackLayout slExamTypeLayout = new StackLayout
            {
                Children          = { slExamTypeFrmaeLayout },
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                IsVisible         = false
            };

            Image imgExamDropDown = new Image {
                Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand
            };
            Label lblExam = new Label {
                TextColor = Color.Black, Text = "Exam"
            };
            Picker pcrExam = new Picker {
                IsVisible = false, Title = "Exam"
            };

            StackLayout slExamDisplay = new StackLayout {
                Children = { lblExam, pcrExam, imgExamDropDown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 10, 0), Device.OnPlatform(0, 5, 0))
            };

            Frame frmExam = new Frame
            {
                Content           = slExamDisplay,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                OutlineColor      = Color.Black,
                Padding           = new Thickness(10)
            };

            var examTap = new TapGestureRecognizer();

            examTap.NumberOfTapsRequired = 1; // single-tap
            examTap.Tapped += (s, e) =>
            {
                pcrExam.Focus();
            };
            frmExam.GestureRecognizers.Add(examTap);
            slExamDisplay.GestureRecognizers.Add(examTap);

            StackLayout slExamFrmaeLayout = new StackLayout
            {
                Children = { frmExam }
            };

            StackLayout slExamLayout = new StackLayout
            {
                Children          = { slExamFrmaeLayout },
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            StackLayout slSearchLayout = new StackLayout
            {
                Orientation = StackOrientation.Vertical,
                Padding     = new Thickness(0, 0, 0, 10),
                Children    = { slStandardLayout, slExamTypeLayout, slExamLayout }
            };

            _NotAvailData = new Label {
                Text = "No data availalble for this search data.", TextColor = Color.Red, IsVisible = false
            };

            _Loader = new LoadingIndicator();

            //Stanndard Picker Selected
            pcrStandard.SelectedIndexChanged += (sender, e) =>
            {
                Device.BeginInvokeOnMainThread(async() =>
                {
                    _Loader.IsShowLoading = true;
                    pcrExam.Items.Clear();
                    pcrExamType.Items.Clear();
                    Items.Clear();

                    string standardName = lblStandard.Text = pcrStandard.Items[pcrStandard.SelectedIndex];

                    _SelectedStandardID = _StandardList.Where(x => x.Name == standardName).FirstOrDefault().Id;

                    _ExamTypeList = await ExamTypeModel.GetExamType();

                    if (_ExamTypeList.Count > 0 && _ExamTypeList != null)
                    {
                        slExamLayout.IsVisible  = true;
                        _NotAvailData.IsVisible = false;
                    }
                    else
                    {
                        slExamLayout.IsVisible  = false;
                        _NotAvailData.IsVisible = true;
                    }

                    foreach (ExamTypeModel item in _ExamTypeList)
                    {
                        pcrExam.Items.Add(item.Name);
                    }

                    _Loader.IsShowLoading = false;
                });
            };

            pcrExam.SelectedIndexChanged += (sender, e) =>
            {
                Device.BeginInvokeOnMainThread(async() =>
                {
                    Items.Clear();

                    string ExamName = lblExam.Text = pcrExam.Items[pcrExam.SelectedIndex];
                    _SelectedExamID = _ExamTypeList.FirstOrDefault(x => x.Name == ExamName).Id;
                });
            };

            //List view
            ListView StudentListView = new ListView
            {
                RowHeight      = 50,
                SeparatorColor = Color.Gray
            };

            StudentListView.ItemsSource  = Items;
            StudentListView.ItemTemplate = new DataTemplate(() => new StudentExamMarksCell());

            //Grid Header Layout
            Label lblAttendance = new Label
            {
                Text      = "Attendance",
                TextColor = Color.Black
            };

            StackLayout slAttendance = new StackLayout
            {
                Children          = { lblAttendance },
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.StartAndExpand
            };

            Label lblStudent = new Label
            {
                Text      = "Student",
                TextColor = Color.Black
            };

            StackLayout slStudentName = new StackLayout
            {
                Children          = { lblStudent },
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand
            };

            Label lblIsPresent = new Label
            {
                Text      = "A/P",
                TextColor = Color.Black
            };

            StackLayout slExamMarks = new StackLayout
            {
                Children          = { lblIsPresent },
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.EndAndExpand
            };

            StackLayout grid = new StackLayout
            {
                Children    = { slAttendance, slStudentName, slExamMarks },
                Orientation = StackOrientation.Horizontal,
                IsVisible   = false
            };

            Seperator spDisplayHeader = new Seperator();

            Button btnSave = new Button();

            btnSave.Text            = "Save";
            btnSave.TextColor       = Color.White;
            btnSave.BackgroundColor = LayoutHelper.ButtonColor;

            btnSave.Clicked += (sender, e) =>
            {
                Device.BeginInvokeOnMainThread(async() =>
                {
                    _Loader.IsShowLoading = true;

                    SaveStudentMarksMaster saveStudentMarksMaster = new SaveStudentMarksMaster();

                    //fillupAttendanceModel.StandardId = _SelectedStandardID;
                    //fillupAttendanceModel.ClassTypeId = _SelectedClassTypeID;
                    //fillupAttendanceModel.Date = Convert.ToDateTime(lblCurrentDate.Text).ToString("dd/MM/yyyy");
                    //fillupAttendanceModel.Students = Items.ToList();

                    bool isSaveAttendance = await SaveStudentMarksMaster.SaveStudentMarks(saveStudentMarksMaster);

                    if (isSaveAttendance)
                    {
                        await DisplayAlert(string.Empty, "Save Successfully.", Messages.Ok);
                    }
                    else
                    {
                        await DisplayAlert(Messages.Error, "Some problem ocuured when saving data.", Messages.Ok);
                    }
                    _Loader.IsShowLoading = false;
                });
            };

            var cvBtnSave = new ContentView
            {
                Padding = new Thickness(10, 5, 10, 10),
                Content = btnSave
            };

            StackLayout slExamType = new StackLayout
            {
                Children =
                {
                    new StackLayout {
                        Padding         = new Thickness(20, Device.OnPlatform(40, 20, 0), 20, 20),
                        Children        = { slTitle, spTitle.LineSeperatorView, slSearchLayout, _Loader, _NotAvailData },
                        VerticalOptions = LayoutOptions.FillAndExpand,
                    },
                },
                BackgroundColor = LayoutHelper.PageBackgroundColor
            };

            Content = new ScrollView
            {
                Content = slExamType,
            };
        }
Exemplo n.º 27
0
        public DiscountPage()
            : base(typeof(DiscountViewModel), typeof(DiscountContentUI), PanelSetEnum.psRight)
        {
            BackgroundColor         = MainStyles.StatusBarColor.FromResources <Color>();
            Content.BackgroundColor = MainStyles.MainLightBackgroundColor.FromResources <Color>();

            var appBar = new TitleBar(this, TitleBar.BarBtnEnum.bbBackRight)
            {
                BarColor = MainStyles.StatusBarColor.FromResources <Color>(),
                BtnBack  =
                {
                    Source = contentUI.IconBack
                },
                BtnRight =
                {
                    Triggers                 =
                    {
                        new DataTrigger(typeof(ImageButton))
                        {
                            Binding = new Binding("IsCustomFiltering"),
                            Value   = true,
                            Setters =
                            {
                                new Setter
                                {
                                    Property = ImageButton.SourceProperty,
                                    Value    = contentUI.IconMoreFilter
                                }
                            }
                        },
                        new DataTrigger(typeof(ImageButton))
                        {
                            Binding = new Binding("IsCustomFiltering"),
                            Value   = false,
                            Setters =
                            {
                                new Setter
                                {
                                    Property = ImageButton.SourceProperty,
                                    Value    = contentUI.IconMore
                                }
                            }
                        }
                    }
                }
            };

            appBar.BtnRight.Click += BtnFilter_Click;

            InitSearchBar(appBar);
            InitFilterPanel();

            var listViewFooter = new ContentView
            {
                HeightRequest = 4
            };

            var discountListView = new ListView(ListViewCachingStrategy.RetainElement)
            {
                BackgroundColor     = MainStyles.MainLightBackgroundColor.FromResources <Color>(),
                SeparatorVisibility = SeparatorVisibility.None,
                SelectionMode       = ListViewSelectionMode.None,
                ItemTemplate        = new DataTemplate(typeof(DiscountItemTemplate)),
                RowHeight           = Functions.OnPlatform(125, 135),
                Header = new ContentView
                {
                    HeightRequest = 4
                },
                Footer = new ContentView
                {
                    Content = listViewFooter
                }
            };

            discountListView.SetBinding(ListView.ItemsSourceProperty, "DiscountItems");
            discountListView.SetBinding(IsVisibleProperty, "HasDiscountItems");
            discountListView.ItemSelected += (sender, args) => ((ListView)sender).SelectedItem = null;
            discountListView.ItemTapped   += viewModel.OnDiscountItemTapped;

            var emptyLabel = new Label
            {
                Style             = LabelStyles.EmptyListLabelStyle.FromResources <Style>(),
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                Text = contentUI.TxtEmptyList
            };

            emptyLabel.SetBinding(IsVisibleProperty, "HasNoDiscountItems");

            var safeAreaHelper = new SafeAreaHelper();

            safeAreaHelper.UseSafeArea(this, SafeAreaHelper.CustomSafeAreaFlags.Top);
            safeAreaHelper.UseSafeArea(appBar.BtnBack, SafeAreaHelper.CustomSafeAreaFlags.Left);
            safeAreaHelper.UseSafeArea(appBar.BtnRight, SafeAreaHelper.CustomSafeAreaFlags.Right);
            safeAreaHelper.UseSafeArea(RightPanel.Content, SafeAreaHelper.CustomSafeAreaFlags.Right);
            safeAreaHelper.UseSafeArea(discountListView, SafeAreaHelper.CustomSafeAreaFlags.Horizontal);
            safeAreaHelper.UseSafeArea(listViewFooter, SafeAreaHelper.CustomSafeAreaFlags.Bottom);
            safeAreaHelper.UseSafeArea(emptyLabel, SafeAreaHelper.CustomSafeAreaFlags.Horizontal);

            ContentLayout.Children.Add(appBar);
            ContentLayout.Children.Add(discountListView);
            ContentLayout.Children.Add(emptyLabel);
        }
Exemplo n.º 28
0
 public NSNavigationController()
 {
     AddSubview(Toolbar         = new TitleBar());
     AddSubview(MainContentView = new NSView());
 }
Exemplo n.º 29
0
 public void SetExitHidden(bool hidden)
 {
     TitleBar.SetExitButtonVisible(!hidden);
 }
Exemplo n.º 30
0
        private void CreateControls()
        {
            Size        = new Size(557, 543);
            MinimumSize = Size;

            Content = new Panel {
                Anchor    = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom,
                Size      = new Size(Width - 1, Height - 1),
                Location  = new Point(1, 1),
                BackColor = primaryColor,
                Parent    = this
            };

            canvas = new Canvas {
                Location = new Point(5, TitleBar.Bottom + 5),
                Size     = new Size(544, 480),
                Parent   = Content
            };

            appleBox = new PictureBox {
                SizeMode = PictureBoxSizeMode.StretchImage,
                Image    = Properties.Resources.Apple,
                Location = new Point(10, 9),
                Size     = new Size(32, 32),
                Parent   = TitleBar
            };
            TitleBar.AddTitleBarListeners(appleBox);

            scoreLbl = new Label {
                Font      = new Font(SecondaryFontFamily, 14, FontStyle.Regular),
                TextAlign = ContentAlignment.BottomLeft,
                Location  = new Point(appleBox.Right + 5, 9),
                Size      = new Size(60, 32),
                ForeColor = Color.White,
                AutoSize  = false,
                Parent    = TitleBar,
                Text      = "0"
            };
            TitleBar.AddTitleBarListeners(scoreLbl);

            crownBox = new PictureBox {
                SizeMode = PictureBoxSizeMode.StretchImage,
                Image    = Properties.Resources.Crown,
                Location = new Point(scoreLbl.Right + 5, 9),
                Size     = new Size(32, 32),
                Parent   = TitleBar,
                Visible  = false
            };
            TitleBar.AddTitleBarListeners(crownBox);

            bestScoreLbl = new Label {
                Font      = new Font(SecondaryFontFamily, 14, FontStyle.Regular),
                TextAlign = ContentAlignment.BottomLeft,
                Location  = new Point(crownBox.Right + 5, 9),
                Size      = new Size(60, 32),
                ForeColor = Color.White,
                AutoSize  = false,
                Parent    = TitleBar,
                Visible   = false
            };
            TitleBar.AddTitleBarListeners(bestScoreLbl);

            CultureInfo info = new CultureInfo(NativeMethods.GetUserDefaultLCID());

            System.Threading.Thread.CurrentThread.CurrentUICulture = info;
        }
Exemplo n.º 31
0
        public SettingsPage()
            : base(typeof(SettingsViewModel), typeof(SettingsContentUI))
        {
            BackgroundColor         = MainStyles.StatusBarColor.FromResources <Color>();
            Content.BackgroundColor = MainStyles.MainBackgroundColor.FromResources <Color>();

            var loadingColor = MainStyles.LoadingColor.FromResources <Color>();

            LoadingActivityIndicator.Color = loadingColor;
            LoadingActivityText.TextColor  = loadingColor;

            var appBar = new TitleBar(this, TitleBar.BarBtnEnum.bbBack)
            {
                BarColor   = MainStyles.StatusBarColor.FromResources <Color>(),
                TitleStyle = LabelStyles.PageTitleStyle.FromResources <Style>(),
                BtnBack    =
                {
                    Source = contentUI.IconBack
                }
            };

            appBar.SetBinding(TitleBar.TitleProperty, "Title");

            #region Language setting

            var txtLangTitle = new Label
            {
                Style = LabelStyles.SettingStyle.FromResources <Style>()
            };
            txtLangTitle.SetBinding(Label.TextProperty, "CurrentLanguageTitle");

            var txtLangValue = new Label
            {
                Style = LabelStyles.SettingHintStyle.FromResources <Style>()
            };
            txtLangValue.SetBinding(Label.TextProperty, "CurrLanguageName");

            var stackLang = new StackLayout
            {
                Children =
                {
                    txtLangTitle,
                    txtLangValue
                }
            };

            var tapLang = new TapGestureRecognizer();
            tapLang.Tapped += viewModel.LangSetting_Click;
            stackLang.GestureRecognizers.Add(tapLang);

            #endregion

            #region Push notifications setting

            var txtPushNotifications = new Label
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.Center,
                Style             = LabelStyles.SettingStyle.FromResources <Style>()
            };
            txtPushNotifications.SetBinding(Label.TextProperty, "PushNotificationsTitle");

            var switchPushNotifications = new Switch
            {
                HorizontalOptions = LayoutOptions.End,
                VerticalOptions   = LayoutOptions.Center,
                OnColor           = MainStyles.SwitchColor.FromResources <Color>()
            };
            switchPushNotifications.SetBinding(Switch.IsToggledProperty, "IsPushEnabled");

            var stackPushNotifications = new StackLayout
            {
                Orientation       = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Spacing           = 0,
                Children          =
                {
                    txtPushNotifications,
                    switchPushNotifications
                }
            };

            var tapPushNotifications = new TapGestureRecognizer();
            tapPushNotifications.Tapped += viewModel.SwitchPushNotifications_Toggled;
            stackPushNotifications.GestureRecognizers.Add(tapPushNotifications);

            #endregion

            var btnUpdateDb = new ButtonExtended
            {
                Style = LabelStyles.ButtonStyle.FromResources <Style>()
            };
            btnUpdateDb.SetBinding(Button.TextProperty, "UpdateDbTitle");
            btnUpdateDb.SetBinding(IsEnabledProperty, "IsNotLoading");
            btnUpdateDb.Clicked += viewModel.BtnUpdateDb_Clicked;

            var activityIndicator = new ActivityIndicator
            {
                Color             = loadingColor,
                HorizontalOptions = LayoutOptions.Center
            };
            activityIndicator.SetBinding(IsVisibleProperty, "IsUpdating");
            activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, "IsUpdating");

            var txtProgress = new Label
            {
                Style = LabelStyles.DescriptionLightStyle.FromResources <Style>(),
                HorizontalTextAlignment = TextAlignment.Center
            };
            txtProgress.SetBinding(Label.TextProperty, "ProcessMessage");

            var layoutSettings = new StackLayout
            {
                Spacing  = 20,
                Padding  = 24,
                Children =
                {
                    stackLang,
                    stackPushNotifications,
                    btnUpdateDb,
                    activityIndicator,
                    txtProgress
                }
            };

            var safeAreaHelper = new SafeAreaHelper();
            safeAreaHelper.UseSafeArea(this, SafeAreaHelper.CustomSafeAreaFlags.Top);
            safeAreaHelper.UseSafeArea(appBar.BtnBack, SafeAreaHelper.CustomSafeAreaFlags.Left);
            safeAreaHelper.UseSafeArea(layoutSettings, SafeAreaHelper.CustomSafeAreaFlags.Horizontal);

            ContentLayout.Children.Add(appBar);
            ContentLayout.Children.Add(layoutSettings);
        }