private void CreateMultiVChatRoomCallback(int code, long channel_id, string json_extension)
 {
     if (code == 200)
     {
         NIM.NIMJoinRoomJsonEx joinRoomJsonEx = new NIMJoinRoomJsonEx();
         CustomLayout          layout_json    = new CustomLayout();
         layout_json.Hostarea   = new HostArea();
         layout_json.Background = new BackGround();
         joinRoomJsonEx.Layout  = layout_json.Serialize();
         //创建房间成功,将内容抛至UI线程
         Action action = () =>
         {
             if (VChatAPI.JoinRoom(NIMVideoChatMode.kNIMVideoChatModeVideo, room_name, joinRoomJsonEx, _joinroomcb))
             {
                 //调用成功
             }
             else
             {
                 string info = String.Format("加入房间-{0}-失败", room_name);
                 MessageBox.Show(info);
             }
         };
         this.Invoke(action);
     }
     else
     {
         Action action = () =>
         {
             MessageBox.Show("创建房间失败-错误码:" + code.ToString());
         };
         this.BeginInvoke(action);
     }
 }
        public CustomMenuItemCell()
        {

            CustomLayout masterLayout = new CustomLayout();
            masterLayout.BackgroundColor = Constants.MENU_BG_COLOR;
            //IDeviceSpec deviceSpec = DependencyService.Get<IDeviceSpec>();
            double screenWidth = App.screenWidth;
            double screenHeight = App.screenHeight;
            Label name = new Label();
            name.SetBinding(Label.TextProperty, "Name");
            name.TextColor = Constants.MAIN_MENU_TEXT_COLOR;//Color.Black;
            name.FontFamily = Constants.HELVERTICA_NEUE_LT_STD;
            name.FontSize = Device.OnPlatform(12, 17, 18);

            StackLayout divider = new StackLayout();
            divider.WidthRequest = screenWidth;
            divider.HeightRequest = .75;
            divider.BackgroundColor = Color.FromRgb(255, 255, 255);

            Image sideImage = new Image();
            sideImage.WidthRequest = 25;
            sideImage.HeightRequest = 25;
            sideImage.SetBinding(Image.SourceProperty, "ImageName");
            sideImage.Aspect = Aspect.Fill;

            masterLayout.WidthRequest = screenWidth;
            masterLayout.HeightRequest = screenHeight * Device.OnPlatform(30, 50, 10) / 100;

            masterLayout.AddChildToLayout(sideImage, (float)5, (float)Device.OnPlatform(5, 0, 50), (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest);
			masterLayout.AddChildToLayout(name, (float)Device.OnPlatform( 15, 15 , 15 ), (float)Device.OnPlatform(5, 0, 50), (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest);
           // masterLayout.AddChildToLayout(divider, (float)1, (float)20, (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest);
            this.View = masterLayout;
        }
        public TestPage()
        {
            NavigationPage.SetHasNavigationBar(this, false);
            CustomLayout masterLayout = new CustomLayout();
            masterLayout.BackgroundColor = Color.Transparent;

            IDeviceSpec deviceSpec = DependencyService.Get<IDeviceSpec>();


            StackLayout layout = new StackLayout();
            layout.WidthRequest = deviceSpec.ScreenWidth;
            layout.HeightRequest = deviceSpec.ScreenHeight * 50 / 100;
            layout.BackgroundColor = Color.Transparent;


            StackLayout layout2 = new StackLayout();
            layout2.WidthRequest = deviceSpec.ScreenWidth;
            layout2.HeightRequest = deviceSpec.ScreenHeight * 50 / 100;
            layout2.BackgroundColor = Color.Red;


            masterLayout.AddChildToLayout( layout, 0, 0 );
            masterLayout.AddChildToLayout(layout2, 0, 50);

            Content = masterLayout;
        }
Exemple #4
0
            //Draw graph
            public override void DrawOverlayWindow()
            {
                if (showValues)
                {
                    GUI.BringWindowToFront(-id - 1);
                    Rect backgroundRect = new Rect(0, 0, overlayWindowRect.width, overlayWindowRect.height);
                    backgroundRect.x      += 2;
                    backgroundRect.y      += 2;
                    backgroundRect.width  -= 4;
                    backgroundRect.height -= 4;

                    //GUI.Box(backgroundBorderRect, "", "propertyField");
                    GUI.Box(backgroundRect, "", "box");

                    //Graph
                    DrawGraphLines();
                    ControlPoints = CustomLayout.CurveGraph(ControlPoints, "Graph View");

                    ContextMenu();
                    DeletePoint();

                    //Highlight selected point
                    if (selectedPoint != -1)
                    {
                        GUI.Box(selectionRect, "", "graphPointSelection");
                    }
                }
            }
        public GoalsMainPage()
        {

            NavigationPage.SetHasNavigationBar(this, false);
            masterLayout = new CustomLayout();
            masterLayout.BackgroundColor = Color.FromRgb(244, 244, 244);
            progressBar = DependencyService.Get<IProgressBar>();


            this.Appearing += OnAppearing;
			mainTitleBar = new GemsPageTitleBar(Color.FromRgb(8, 135, 224), "Goals & Dreams", Color.White, "", true);
            mainTitleBar.imageAreaTapGestureRecognizer.Tapped += OnImageAreaTapGestureRecognizerTapped;


            masterScroll = new ScrollView();
            masterScroll.WidthRequest = App.screenWidth - 20;
            masterScroll.HeightRequest = App.screenHeight * 85 / 100;
            masterScroll.BackgroundColor = Color.FromRgb( 244, 244, 244 );
			masterScroll.IsClippedToBounds = true;

            masterStack = new StackLayout();
            masterStack.Orientation = StackOrientation.Vertical;
            masterStack.BackgroundColor = Color.FromRgb(244, 244, 244);
            masterStack.Spacing = 0;
            //masterStack.Padding = new Thickness( 10, 10, 10, 10 );




        }
        public CustomListViewCellItem()
        {
            CustomLayout masterLayout = new CustomLayout();
            masterLayout.BackgroundColor = Color.White;//Constants.LIST_BG_COLOR;
            double screenWidth = App.screenWidth;
            double screenHeight = App.screenHeight;
            Label name = new Label();
            name.SetBinding(Label.TextProperty, "Name");
            name.TextColor = Color.Black;
            name.FontFamily = Constants.HELVERTICA_NEUE_LT_STD;
            int fontSize = 15;
            //name.FontSize = 18;
            if (App.screenDensity > 1.5)
            {
                fontSize = 17;
            }
            else
            {
                fontSize = 15;
            }
            name.FontSize = Device.OnPlatform( fontSize, fontSize, 22 );

            StackLayout divider = new StackLayout();
            divider.WidthRequest = screenWidth;
            divider.HeightRequest = 1;
            divider.BackgroundColor = Color.FromRgb(220, 220, 220);

            masterLayout.WidthRequest = screenWidth * 60 / 100;
            masterLayout.HeightRequest = screenHeight * Device.OnPlatform(30, 30, 7) / 100;

            masterLayout.AddChildToLayout(name, (float)5, (float)Device.OnPlatform(5, 5, 50), (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest);
            masterLayout.AddChildToLayout(divider, 0, (float)Device.OnPlatform(20, 20, 5), (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest);

            this.View = masterLayout;
        }
Exemple #7
0
        private Slide AddSlide(Presentation pptPreso, string image)
        {
            CustomLayout pptLayout = default(CustomLayout);

            if ((pptPreso.SlideMaster.CustomLayouts._Index(7) == null))
            {
                pptLayout = pptPreso.SlideMaster.CustomLayouts._Index(1);
            }
            else
            {
                pptLayout = pptPreso.SlideMaster.CustomLayouts._Index(7);
            }

            // Create newSlide by using pptLayout.
            Slide newSlide =
                pptPreso.Slides.AddSlide((pptPreso.Slides.Count + 1), pptLayout);

            Image img = Image.FromFile(image);

            // Prepare to center the image.
            float sldHeight = pptPreso.PageSetup.SlideHeight;
            float sldWidth  = pptPreso.PageSetup.SlideWidth;

            var left = sldWidth * .5f - (float)img.Width * .5f;
            var top  = sldHeight * .5f - (float)img.Height * .5f;

            // Finally, add the picture... centered in the frame.
            newSlide.Shapes.AddPicture(image, MsoTriState.msoTrue, MsoTriState.msoTrue, left, top, (float)img.Width, (float)img.Height);

            return(newSlide);
        }
        public ApplicationSettingsPage()
        {

            NavigationPage.SetHasNavigationBar(this, false);
            masterLayout = new CustomLayout();
            masterLayout.BackgroundColor = Constants.PAGE_BG_COLOR_LIGHT_GRAY;
            screenWidth = App.screenWidth;
            mainTitleBar = new PurposeColorTitleBar(Color.FromRgb(8, 135, 224), "Purpose Color", Color.Black, "back", true);
            mainTitleBar.imageAreaTapGestureRecognizer.Tapped += imageAreaTapGestureRecognizer_Tapped;
            subTitleBar = new PurposeColorBlueSubTitleBar(Constants.SUB_TITLE_BG_COLOR, "Application Settings",false, true);

            subTitleBar.BackButtonTapRecognizer.Tapped += (s, e) =>
            {
                App.masterPage.IsPresented = !App.masterPage.IsPresented;
            };
            progressBar = DependencyService.Get<IProgressBar>();

            signOutButton = new Button
            {
                Text = "Sign out",
                TextColor = Color.White,
                BorderColor = Color.Transparent,
                BorderWidth = 0,
                BackgroundColor = Constants.BLUE_BG_COLOR
            };

			profileButton = new Button
			{
				Text = "Profile settings",
				TextColor = Color.White,
				BorderColor = Color.Transparent,
				BorderWidth = 0,
				BackgroundColor = Constants.BLUE_BG_COLOR
			};

            changePassword = new Button
            {
                Text = "Change password",
                TextColor = Color.White,
                BorderColor = Color.Transparent,
                BorderWidth = 0,
                BackgroundColor = Constants.BLUE_BG_COLOR
            };

            signOutButton.WidthRequest = screenWidth * 80 / 100;
            changePassword.WidthRequest = screenWidth * 80 / 100;
			profileButton.WidthRequest = screenWidth * 80 / 100;

            masterLayout.AddChildToLayout(mainTitleBar, 0, 0);
            masterLayout.AddChildToLayout(subTitleBar, 0, Device.OnPlatform(9, 10, 10));
			masterLayout.AddChildToLayout(profileButton, 10, 20);
			masterLayout.AddChildToLayout(changePassword, 10, Device.OnPlatform(30, 30,28));
			//masterLayout.AddChildToLayout( signOutButton, 10, Device.OnPlatform(40, 40,38));
            signOutButton.Clicked += OnSignOutButtonClicked;
            changePassword.Clicked += ChangePassword_Clicked;
			profileButton.Clicked += ProfileButton_Clicked;

            Content = masterLayout;
        }
		public GemsMoreDetailsPage(GemsEmotionsDetails emotionsList, GemsGoalsDetails goalsList, string eventMedia, string eventMediaThumb, string eventNoMedia, string goalsMedia, string goalsMediaThumb, string goalsNoMedia)
        {

            NavigationPage.SetHasNavigationBar(this, false);
            masterLayout = new CustomLayout();
            masterLayout.BackgroundColor = Color.FromRgb(244, 244, 244);
			IProgressBar progressBar = DependencyService.Get<IProgressBar>();
            eventsMediaPath = eventMedia;
            eventsMediaThumbPath = eventMediaThumb;
			goalsMediaPath = goalsMedia;
			goalsMediaThumbPath = goalsMediaThumb;
			goalsNoMediaPath = goalsNoMedia;
			eventsNoMediaPath = eventNoMedia;
            emotionsMasterList = emotionsList;
			goalsMasterList = goalsList;
			isFirstTime = true;


            // PurposeColorTitleBar mainTitleBar = new PurposeColorTitleBar(Color.FromRgb(8, 135, 224), "Purpose Color", Color.Black, "back", false);
            mainTitleBar = new GemsPageTitleBarWithBack(Color.FromRgb(8, 135, 224), "Add Supporting Emotions", Color.White, "", false);
			mainTitleBar.imageAreaTapGestureRecognizer.Tapped += (object sender, EventArgs e) => 
			{
                try
                {
					App.masterPage.IsPresented = !App.masterPage.IsPresented;
                }
                catch (Exception)
                {
                    
                }
			};

            if (emotionsMasterList != null)
            {
                mainTitleBar.title.Text = emotionsMasterList.emotion_title;
            }
            else
            {
                mainTitleBar.title.Text = goalsMasterList.goal_title;
            }


            masterScroll = new ScrollView();
            masterScroll.WidthRequest = App.screenWidth;
            masterScroll.HeightRequest = App.screenHeight * 85 / 100;
			masterScroll.IsClippedToBounds = true;
            masterStack = new StackLayout();
            masterStack.Orientation = StackOrientation.Vertical;
            masterStack.BackgroundColor = Color.Transparent;


			this.Appearing += OnAppearing;


            masterScroll.Content = masterStack;
            masterLayout.AddChildToLayout(mainTitleBar, 0, 0);
            masterLayout.AddChildToLayout(masterScroll, 0, 10);
            Content = masterLayout;
        }
Exemple #10
0
 private static void LoopMasterShape(CustomLayout layout)
 {
     foreach (Shape shp in layout.Shapes)
     {
         RenameShape(shp);
         DeleteText(shp);
     }
 }
Exemple #11
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            ViewGroup vg = new CustomLayout(this);

            SetContentView(vg);
        }
Exemple #12
0
        public void initPPT()
        {
            _pptApplication = new Application();

            _pptPresentation = _pptApplication.Presentations.Add(Office.MsoTriState.msoTrue);

            _customLayout = _pptPresentation.SlideMaster.CustomLayouts[PpSlideLayout.ppLayoutText];
        }
Exemple #13
0
 public void Remove(CustomLayout info)
 {
     if (info != null)
     {
         LayoutsList.Remove(info);
         Save();
     }
 }
Exemple #14
0
 public void Add(CustomLayout info)
 {
     if (info != null)
     {
         LayoutsList.Add(info);
         Save();
     }
 }
Exemple #15
0
 protected CustomRenderingView()
 {
     Layout = new CustomLayout
     {
         SizeUpdated = OnResized
     };
     MainloopContext = SynchronizationContext.Current ?? throw new InvalidOperationException("Must create on main thread");
 }
        public PowerPointExporter(ScheduleContext context, Presentation presentation)
        {
            if (context == null) throw new ArgumentNullException("context");
            if (presentation == null) throw new ArgumentNullException("presentation");

            Context = context;
            Presentation = presentation;
            defaultLayout = GetLayout("Announcements");
        }
Exemple #17
0
        public void OnChildAddedCalled()
        {
            var layout = new CustomLayout();
            var button = new Button();

            Assert.AreEqual(0, layout.AddedCount);
            layout.Add(button);
            Assert.AreEqual(1, layout.AddedCount);
        }
Exemple #18
0
 public void AddLayout(CustomLayout layout, int index)
 {
     layout.transform.SetParent(LayoutGroup.transform);
     layout.transform.SetSiblingIndex(index);
     foreach (Transform child in LayoutGroup.transform)
     {
         child.GetComponent <CustomLayout>().SetPaddingBySibling();
     }
 }
        public CameraPage()
        {
            NavigationPage.SetHasNavigationBar(this, false);
            CustomLayout masterLayout = new CustomLayout();
            masterLayout.BackgroundColor = Color.Gray;
            IDeviceSpec deviceSpec = DependencyService.Get<IDeviceSpec>();


        }
Exemple #20
0
        /// <summary>
        /// Create new slide
        /// </summary>
        /// <param name="pptPresentation">current ppt presentation file</param>
        /// <param name="customLayout">custom layout for slide</param>
        private void CreateNewSlide(Presentation pptPresentation, CustomLayout customLayout)
        {
            // Create new Slide
            slides = pptPresentation.Slides;
            slide  = slides.AddSlide(slide.SlideIndex + 1, customLayout);

            Microsoft.Office.Interop.PowerPoint.Shape shape = slide.Shapes.AddLabel(Microsoft.Office.Core.MsoTextOrientation.msoTextOrientationHorizontal, 120, 500, 200, 70);
            shape.TextFrame.TextRange.Text = "Footer text goes here" + slide.SlideIndex.ToString();
        }
 //si childcount = 0 -> possède des enfants
 //déplace le content
 //destroy this (le gameObject actuel)
 public void clean()
 {
     if (transform.parent.childCount != 0 && transform.parent != null)
     {
         CustomLayout parentLayout = transform.parent.parent.GetComponent <CustomLayout>();
         ContentRectTransform.transform.SetParent(parentLayout.transform.GetChild(0));
         DestroyImmediate(m_customLayout.transform);
     }
 }
Exemple #22
0
        public void initPPTAutomation()
        {
            _pptApplication = new Application();

            _pptPresentation = _pptApplication.Presentations.Add(Office.MsoTriState.msoTrue);

            _customLayout = _pptPresentation.SlideMaster.CustomLayouts[PpSlideLayout.ppLayoutText];

            // 새 슬라이드 생성
            _slides = _pptPresentation.Slides;
            _slide  = _slides.AddSlide(1, _customLayout);

            // 타이틀 추가
            _objText      = _slide.Shapes[1].TextFrame.TextRange;
            _objText.Text = "제목입니당";
            //TOAN : 01/28/2019. FontName에서 Exception이 발생하는듯 하다.
            //_objText.Font.Name = "Gulim";
            //_objText.Font.Size = 32;
            _objText.Font.Size = 20;
            _objText           = _slide.Shapes[2].TextFrame.TextRange;
            //_objText.Text = "1번째줄\n2번째줄\n3번째줄";
            int ioop = 0;

            //int ioop = 48;
            for (ioop = 0; ioop < 10; ioop++)
            {
                _objText.Text += ioop.ToString();
                _objText.Text += "\n";
                //아래 코드를 사용하면 루프중에 프로그램이 종료되버린다.
                //Delay(1000);
            }

            //TOAN : 01/28/2019. Temporary Blocking
            _slide.NotesPage.Shapes[2].TextFrame.TextRange.Text = "여기는 슬라이드 설명쓰는곳입니당.";

            //File저장 영역은 현재 디렉토리에 저장을 시켜 준다.
            //_pptPresentation.SaveAs(@"c:\COOLA\ppttest.pptx", PpSaveAsFileType.ppSaveAsDefault, Office.MsoTriState.msoTrue);

            _slide = _slides.AddSlide(2, _customLayout);
            // 타이틀 추가
            _objText = _slide.Shapes[1].TextFrame.TextRange;
            //_objText.Text = "제목입니당";
            _objText.Font.Size = 32;
            _objText.Text      = "제목";

            //Delay(5000);

            _objText.Text      = _objText.Text + "입니당";
            _objText.Font.Name = "Gulim";
            _objText.Font.Size = 32;

            _objText      = _slide.Shapes[2].TextFrame.TextRange;
            _objText.Text = "4번째줄\n5번째줄\n6번째줄";

            _slide.NotesPage.Shapes[2].TextFrame.TextRange.Text = "여기는 슬라이드 설명쓰는곳입니당.";
        }
Exemple #23
0
        public MainWindow()
        {
            InitializeComponent();

            pptApplication = new Microsoft.Office.Interop.PowerPoint.Application();

            // Create the Presentation File
            pptPresentation = pptApplication.Presentations.Add(MsoTriState.msoTrue);
            customLayout    = pptPresentation.SlideMaster.CustomLayouts[PpSlideLayout.ppLayoutText];
        }
Exemple #24
0
        public void AddBlankSlide()
        {
            CustomLayout customLayout = _presentation.SlideMaster.CustomLayouts[PpSlideLayout.ppLayoutText];
            Slide        slide        = _slides.AddSlide(_slides.Count + 1, customLayout);

            int cnt = slide.Shapes.Count;

            for (int i = 0; i < cnt; i++)
            {
                slide.Shapes[1].Delete();
            }
        }
Exemple #25
0
        private void CheckOfficePermissions()
        {
            System.Diagnostics.Debug.WriteLine("Checking Office Permissions");

            Application pptApp = null;
            int         pId    = 0;

            try
            {
                // Prüft ob auf dem Rechner alle erforderlichen Rechte vorliegen um Reports zu erstellen
                // Es wird ein Testreport erstellt

                FileUtil.DeleteAllFilesInDirectory(_globalSettings.ReportDirectory_PPT_Init);

                pptApp = new Application();
                pId    = ProcessUtil.GetProcessId(pptApp, ApplicationType.POWERPOINT);

                Presentation ppt          = pptApp.Presentations.Add(MsoTriState.msoFalse);
                CustomLayout customLayout = ppt.SlideMaster.CustomLayouts[PpSlideLayout.ppLayoutText];
                Slides       slides       = ppt.Slides;
                _Slide       slide        = slides.AddSlide(1, customLayout);

                TextRange objText = slide.Shapes[1].TextFrame.TextRange;
                objText.Text      = "Test1";
                objText.Font.Name = "Arial";
                objText.Font.Size = 20;

                ppt.SaveAs(Path.Combine(_globalSettings.ReportDirectory_PPT_Init, "Text.pptx"), PpSaveAsFileType.ppSaveAsDefault, MsoTriState.msoFalse);
                ppt.Close();

                ProcessUtil.KillOfficeApplication(pptApp, ApplicationType.POWERPOINT, true);

                ppt    = null;
                pptApp = null;

                GC.Collect();
            }
            catch (Exception ex)
            {
                try
                {
                    ProcessUtil.KillOfficeApplication(pptApp, ApplicationType.POWERPOINT, true);
                }
                catch (Exception) {
                    ProcessUtil.KillProcessById(pId);
                }

                pptApp = null;

                throw new Exception("Error Creating Test PPT Report", ex);
            }
        }
Exemple #26
0
        private void Create_Click(object sender, EventArgs e)
        {
            // Create a new PowerPoint File
            Microsoft.Office.Interop.PowerPoint.Application pptFile = new Microsoft.Office.Interop.PowerPoint.Application();
            Presentation pptPresentation = pptFile.Presentations.Add(MsoTriState.msoTrue);
            CustomLayout customLayout    = pptPresentation.SlideMaster.CustomLayouts[PpSlideLayout.ppLayoutText];

            // Create the first slide
            Slides    firstSlide;
            _Slide    slide;
            TextRange objText;

            firstSlide = pptPresentation.Slides;
            slide      = firstSlide.AddSlide(1, customLayout);

            // Add title from title textbob
            objText           = slide.Shapes[1].TextFrame.TextRange;
            objText.Text      = titleTextBox.Text;
            objText.Font.Name = "Arial";
            objText.Font.Size = 48;

            // Add content from text textbox
            objText           = slide.Shapes[2].TextFrame.TextRange;
            objText.Text      = textTextBox.Text;
            objText.Font.Size = 28;

            // create new slides for images
            for (int i = 0; i < imgIndex.Count; i++)
            {
                Slides    iSlide;
                _Slide    picSlide;
                TextRange picRange;
                iSlide   = pptPresentation.Slides;
                picSlide = iSlide.AddSlide(2, customLayout);

                picRange = picSlide.Shapes[1].TextFrame.TextRange;
                Microsoft.Office.Interop.PowerPoint.Shape shape = picSlide.Shapes[1];

                string url = srcList[imgIndex[i]];

                string filename = Path.GetFileNameWithoutExtension(Path.GetRandomFileName()) + ".png";
                string filePath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
                try
                {
                    WebClient client = new WebClient();
                    client.DownloadFile(url, filePath + "\\" + filename);
                    string picFile = filePath + "\\" + filename;
                    picSlide.Shapes.AddPicture(picFile, MsoTriState.msoFalse, MsoTriState.msoTrue, shape.Left, shape.Top, shape.Width, shape.Height);
                }
                catch (Exception ex) { }
            }
        }
        public GemsPageTitleBarWithBack(Color backGroundColor, string titleValue, Color titleColor, string backButtonTitle, bool imageRequired = false)
        {
            Cross.IDeviceSpec spec = DependencyService.Get<Cross.IDeviceSpec>();
            int titlebarHeight = (int)spec.ScreenHeight * 10 / 100;
            int titlebarWidth = (int)spec.ScreenWidth;
            this.BackgroundColor = backGroundColor;

            masterLayout = new CustomLayout();
            masterLayout.HeightRequest = titlebarHeight;
            masterLayout.WidthRequest = titlebarWidth;
            masterLayout.BackgroundColor = backGroundColor;



            Image backButton = new Image();
            backButton.Source = Device.OnPlatform("bckarow.png", "bckarow.png", "//Assets//bckarow.png");
            backButton.HeightRequest = 30;
            backButton.WidthRequest = 25;


            imageAreaTapGestureRecognizer = new TapGestureRecognizer();
            backButton.GestureRecognizers.Add(imageAreaTapGestureRecognizer);


            title = new Label();
            title.Text = titleValue;
            title.FontSize = 20;
            title.TextColor = Color.White;

            Image logo = new Image();
            logo.Source = Device.OnPlatform("logo_icon.png", "logo_icon.png", "//Assets//logo_icon.png");
            logo.WidthRequest = spec.ScreenWidth;
            logo.HeightRequest = titlebarHeight;
            logo.WidthRequest = spec.ScreenWidth * 10 / 100;
            logo.HeightRequest = spec.ScreenHeight * 8 / 100;




            masterLayout.AddChildToLayout(logo, 10, 5, (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest);
            masterLayout.AddChildToLayout(title, 22, 30, (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest);
            masterLayout.AddChildToLayout(backButton, 2, 25, (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest);

            if (imageRequired)
            {
                // masterLayout.AddChildToLayout(userImg, 80, Device.OnPlatform( 17, 15, 17 ), (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest);
            }

            Content = masterLayout;

        }
        private void ShowPresentation(string fileName)
        {
            if (dde == null)
            {
                dde = new DigiDentalEntities();
            }

            List <TemplateImages> liTI = new List <TemplateImages>();
            var templateImages         = from ti in dde.TemplateImages
                                         where ti.Patient_ID == Patients.Patient_ID &&
                                         ti.Template_ID == TemplateItem.Template_ID
                                         select ti;

            liTI = templateImages.ToList();

            if (liTI.Count > 0)
            {
                PowerPoint.Application pptApplication = new PowerPoint.Application();

                Slides    slides;
                _Slide    slide;
                TextRange objText;

                // Create the Presentation File
                Presentation pptPresentation = pptApplication.Presentations.Add(MsoTriState.msoTrue);

                CustomLayout customLayout = pptPresentation.SlideMaster.CustomLayouts[PpSlideLayout.ppLayoutText];

                for (int i = 0; i < liTI.Count; i++)
                {
                    // Create new Slide
                    slides = pptPresentation.Slides;
                    slide  = slides.AddSlide(i + 1, customLayout);

                    // Add title
                    objText           = slide.Shapes[1].TextFrame.TextRange;
                    objText.Text      = TemplateItem.Template_Title;
                    objText.Font.Name = "Arial";
                    objText.Font.Size = 32;

                    PowerPoint.Shape shape = slide.Shapes[2];
                    slide.Shapes.AddPicture(Agencys.Agency_ImagePath + liTI[i].Image_Path, MsoTriState.msoFalse, MsoTriState.msoTrue, shape.Left, shape.Top, shape.Width, shape.Height);

                    slide.NotesPage.Shapes[2].TextFrame.TextRange.Text = "This document is created by DigiDental.";
                }
                pptPresentation.SaveAs(fileName, PpSaveAsFileType.ppSaveAsDefault, MsoTriState.msoTrue);
                //pptApplication.Quit();
            }
        }
Exemple #29
0
 public void Add(Side side, RectTransform content, CustomLayout caller = null)
 {
     if ((LayoutGroup is HorizontalLayoutGroup && (side == Side.Top || side == Side.Bottom)) || (LayoutGroup is VerticalLayoutGroup && (side == Side.Left || side == Side.Right)))
     {
         CustomLayout parentLayout = CheckParent();
         parentLayout.AddLayout(this, transform.GetSiblingIndex());
         int index;
         if (side == Side.Left || side == Side.Top)
         {
             index = transform.GetSiblingIndex();
         }
         else
         {
             index = transform.GetSiblingIndex() + 1;
         }
         parentLayout.Add(index, content);
     }
     else
     {
         if (ContentRectTransform.childCount > 0) // Content CustomLayout.
         {
             int index1, index2;
             if (side == Side.Left || side == Side.Top)
             {
                 index1 = 1;
                 index2 = 0;
             }
             else
             {
                 index1 = 0;
                 index2 = 1;
             }
             Add(index1, ContentRectTransform.GetChild(0).GetComponent <RectTransform>());
             Add(index2, content);
         }
         else // Intermediate CustomLayout.
         {
             int index = caller.transform.GetSiblingIndex();
             if (side == Side.Left || side == Side.Top)
             {
             }
             else
             {
                 index++;
             }
             Add(index, content);
         }
     }
 }
Exemple #30
0
 private void DoSave()
 {
     if (_customModel.Count > 0)
     {
         _info = new CustomLayout()
         {
             Split = this.Split, Nodes = _customModel.ToArray(), LayoutName = this.LayoutName
         };
         CustomLayoutScheme.Instance.Add(_info);
         if (SaveAction != null)
         {
             SaveAction();
         }
     }
 }
Exemple #31
0
    public void Add(int index, RectTransform content)
    {
        CustomLayout customLayout = Instantiate(m_Prefab, LayoutGroup.transform).GetComponent <CustomLayout>();

        customLayout.transform.SetSiblingIndex(index);
        if (LayoutGroup is HorizontalLayoutGroup)
        {
            customLayout.Set(Layout.Vertical);
        }
        else
        {
            customLayout.Set(Layout.Horizontal);
        }
        content.SetParent(customLayout.ContentRectTransform);
        DropZoneRectTransform.SetAsLastSibling();
    }
Exemple #32
0
        /// <summary>
        /// 加入一个多人房间(进入房间后成员变化等,等同点对点NIMVChatHander)
        /// </summary>
        /// <param name="mode">音视频通话类型</param>
        /// <param name="room_name">房间名</param>
        /// <param name="joinRoomInfo">json封装类,见NIMJoinRoomJsonEx</param>
        /// <param name="cb">cb 结果回调,返回的json_extension扩展字段中包含 "custom_info","session_id"</param>
        /// <returns>bool true 调用成功,false 调用失败可能有正在进行的通话</returns>
        public static bool JoinRoom(NIMVideoChatMode mode, string room_name, NIMJoinRoomJsonEx joinRoomInfo, NIMVChatOpt2Handler cb)
        {
            if (joinRoomInfo == null)
            {
                joinRoomInfo = new NIMJoinRoomJsonEx();
#if NIMAPI_UNDER_WIN_DESKTOP_ONLY
                CustomLayout layout = new CustomLayout();
                layout.Hostarea     = new HostArea();
                layout.Background   = new BackGround();
                joinRoomInfo.Layout = layout.Serialize();
#endif
            }
            string json_extension = joinRoomInfo.Serialize();
            var    ptr            = NimUtility.DelegateConverter.ConvertToIntPtr(cb);
            return(VChatNativeMethods.nim_vchat_join_room(mode, room_name, json_extension, VChatOpt2Cb, ptr));
        }
        public PowerPointClass(string pptPath, List <Slide> list)
        {
            this.pptPath = pptPath;
            deleteIfExists();

            pptApplication = new Application();
            Presentation presentation = pptApplication.Presentations.Add(MsoTriState.msoTrue);
            CustomLayout customLayout = presentation.SlideMaster.CustomLayouts[PpSlideLayout.ppLayoutText];

            this.slides = presentation.Slides;



            int slideIndex = 1;

            foreach (var item in list)
            {
                // slide
                slide = slides.AddSlide(slideIndex++, customLayout);

                objText           = slide.Shapes[1].TextFrame.TextRange;
                objText.Text      = item.Title.Content;
                objText.Font.Size = item.Title.Size;


                foreach (var bullet in item.Bullets)
                {
                    objText           = slide.Shapes[2].TextFrame.TextRange;
                    objText.Text      = bullet.Content;
                    objText.Font.Size = bullet.Size;
                }
            }

            presentation.SaveAs(pptPath,
                                PpSaveAsFileType.ppSaveAsDefault,
                                MsoTriState.msoTrue);

            presentation.Close();
            try {
                pptApplication.Quit();
            }
            catch (Exception)
            {
                Console.WriteLine("Couldn't exit PowerPoint Application!");
            }
        }
		public ProfileSettingsPage(int userId = 0)
		{
			NavigationPage.SetHasNavigationBar(this, false);
			masterLayout = new CustomLayout();
			masterLayout.BackgroundColor = Constants.PAGE_BG_COLOR_LIGHT_GRAY;
			subTitleBar = new PurposeColorSubTitleBar(Constants.SUB_TITLE_BG_COLOR, "       Profile Info", false, true);
			subTitleBar.BackButtonTapRecognizer.Tapped += (s, e) =>
			{
				try
				{
					Navigation.PopAsync();
				}
				catch (Exception ex)
				{
				}
			};

			mainTitleBar = new PurposeColorTitleBar(Color.FromRgb(8, 135, 224), "Purpose Color", Color.Black, "back", false);
			progressBar = DependencyService.Get<PurposeColor.interfaces.IProgressBar>();
			progressBar.ShowProgressbar ("Retriving user details..");

			try {
				currentUser = App.Settings.GetUser ();
			} catch (Exception ex) {
				
			}

			if (userId != 0) {
				userIdForProfileInfo = userId;
				// get user info from service.
			} 
			else 
			{
				if (currentUser == null) {
					return;
				}
				else
				{
					userInfo = currentUser;
				}
			}

			this.Appearing += ProfileSettingsPage_Appearing;
			progressBar.HideProgressbar ();
		}
        public static void addlicense(String license_url, String license_name, String license_imageurl)
        {
            if (license_added)
            {
                //delete the last slide
                ApplicationInteraction.PowerPointApplication.ActivePresentation.Slides[ApplicationInteraction.PowerPointApplication.ActivePresentation.Slides.Count].Delete();
            }

            license_added = true;

            int left = 80;

            int initial_top = 340;

            //adding slide on last page
            int          totalslides = ApplicationInteraction.PowerPointApplication.ActivePresentation.Slides.Count;
            CustomLayout pptlayout   = ApplicationInteraction.PowerPointApplication.ActivePresentation.Slides[1].CustomLayout; // it starts from 1.. (strage but true)
            Slide        addedslide  = ApplicationInteraction.PowerPointApplication.ActivePresentation.Slides.AddSlide(totalslides + 1, pptlayout);

            addedslide.Layout = PpSlideLayout.ppLayoutBlank;


            Shape ackn = addedslide.Shapes.AddTextbox(Microsoft.Office.Core.MsoTextOrientation.msoTextOrientationHorizontal, left, initial_top, 600, 30);

            ackn.TextFrame.TextRange.Text           = license_name;
            ackn.TextFrame.TextRange.Font.Underline = Microsoft.Office.Core.MsoTriState.msoTrue;
            //ackn.TextFrame.TextRange.Font.Bold = Microsoft.Office.Core.MsoTriState.msoTrue;
            ackn.TextFrame.WordWrap = Microsoft.Office.Core.MsoTriState.msoTrue;

            ackn = addedslide.Shapes.AddTextbox(Microsoft.Office.Core.MsoTextOrientation.msoTextOrientationHorizontal, left, initial_top + 30, 600, 30);
            ackn.TextFrame.TextRange.Text = license_url;
            //ackn.TextFrame.TextRange.Font.Underline = Microsoft.Office.Core.MsoTriState.msoTrue;
            //ackn.TextFrame.TextRange.Font.Bold = Microsoft.Office.Core.MsoTriState.msoTrue;
            ackn.TextFrame.WordWrap = Microsoft.Office.Core.MsoTriState.msoTrue;
            ackn.ActionSettings[PpMouseActivation.ppMouseClick].Hyperlink.Address = license_url;

            Debug.WriteLine(license_imageurl);

            ackn = addedslide.Shapes.AddPicture(
                license_imageurl,
                Microsoft.Office.Core.MsoTriState.msoFalse,
                Microsoft.Office.Core.MsoTriState.msoCTrue,
                left + 9,
                initial_top + 64);
        }
        public AudioRecorderPage()
        {
            NavigationPage.SetHasNavigationBar(this, false);
            CustomLayout masterLayout = new CustomLayout();
            masterLayout.HorizontalOptions = LayoutOptions.Center;
            masterLayout.BackgroundColor = Color.FromRgb(230, 255, 254);
            PurposeColorSubTitleBar subTitleBar = new PurposeColorSubTitleBar(Color.FromRgb(12, 113, 210), "Audio recorder", false);
            masterLayout.AddChildToLayout(subTitleBar, 0, Device.OnPlatform(2, 4, 4));

			PurposeColor.CustomControls.PurposeColorTitleBar titleBar = new PurposeColor.CustomControls.PurposeColorTitleBar(Color.FromRgb(8, 137, 216), "Purpose Color", Color.Black, "back", true);
            masterLayout.AddChildToLayout(titleBar, 0, 0);

            Button recordBtn = new Button
            {
                Text = "Record",
                VerticalOptions = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Center
            };
            recordBtn.Clicked += RecordBtn_Clicked;
            masterLayout.AddChildToLayout(recordBtn, 10, 20);

            Button stopRecordBtn = new Button
            {
                Text = "Stop Recording",
                VerticalOptions = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Center
            };
            stopRecordBtn.Clicked += StopRecordBtn_Clicked;
            masterLayout.AddChildToLayout(stopRecordBtn, 10, 30);


            Button PlaybackBtn = new Button
            {
                Text = "Playback",
                VerticalOptions = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Center
            };
            PlaybackBtn.Clicked += PlaybackBtn_Clicked;
            masterLayout.AddChildToLayout(PlaybackBtn, 10, 40);




            Content = masterLayout;
        }
Exemple #37
0
        private static bool WriteOnSlide()
        {
            var    resultado = false;
            string filePath  = CurrentDirectory() + fileName;

            try
            {
                Application   pptApplication      = new Application();
                Presentations multi_presentations = pptApplication.Presentations;
                Presentation  presentation        = multi_presentations.Open(filePath, MsoTriState.msoFalse, MsoTriState.msoFalse, MsoTriState.msoFalse);
                CustomLayout  customLayout        = presentation.SlideMaster.CustomLayouts[PpSlideLayout.ppLayoutText];

                Slides slides = presentation.Slides;
                Microsoft.Office.Interop.PowerPoint.Shapes shapes = presentation.Slides[1].Shapes;
                TextRange objText;

                slides = presentation.Slides;

                var text1 = "Esto es una prueba de escribir en el titulo";
                var text2 = "Estoy escribiendo en la seccion de contenido de la diapositiva PPT";

                objText           = shapes[1].TextFrame.TextRange;
                objText.Text      = text1;
                objText.Font.Name = "Arial";
                objText.Font.Size = 32;

                objText           = shapes[2].TextFrame.TextRange;
                objText.Text      = text2;
                objText.Font.Name = "Arial";
                objText.Font.Size = 28;

                ReadWriteTxt(filePath);
                presentation.SaveAs(filePath, PpSaveAsFileType.ppSaveAsDefault, MsoTriState.msoTrue);
                presentation.Close();
                pptApplication.Quit();

                resultado = true;
            }
            catch (Exception ex)
            {
                WriteException(ex.ToString());
            }
            return(resultado);
        }
Exemple #38
0
        protected override void OnElementChanged(ElementChangedEventArgs <StackLayout> e)
        {
            base.OnElementChanged(e);

            if (e.OldElement != null || Element == null)
            {
                return;
            }
            try
            {
                stack = e.NewElement as CustomLayout;

                this.StartColor    = stack.StartColor;
                this.EndColor      = stack.EndColor;
                this.gradientStyle = stack.GradientDirection;


                _cornerRadius = 0.0f;
                try
                {
                    if (stack.CornerWRT == CornerRadiusReference.WRTHeightRequest && stack.CornerRadius == 0)
                    {
                        _cornerRadius = (float)(stack.HeightRequest);
                    }
                    else if (stack.CornerWRT == CornerRadiusReference.WRTWidthRequest && stack.CornerRadius == 0)
                    {
                        _cornerRadius = (float)(stack.WidthRequest);
                    }
                    else
                    {
                        _cornerRadius = (float)(stack.CornerRadius);
                    }
                }
                catch (Exception ex)
                {
                    var msg = ex.Message;
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(@"ERROR:", ex.Message);
            }
        }
        public bool CreatePPTExport(ObservableCollection <Templates_Images> observableCollection, string fileName, string pptTitle)
        {
            try
            {
                Application pptApplication = new Application();

                Slides    slides;
                _Slide    slide;
                TextRange objText;

                // Create the Presentation File
                Presentation pptPresentation = pptApplication.Presentations.Add(MsoTriState.msoTrue);

                CustomLayout customLayout = pptPresentation.SlideMaster.CustomLayouts[PpSlideLayout.ppLayoutText];

                for (int i = 0; i < observableCollection.Count(); i++)
                {
                    // Create new Slide
                    slides = pptPresentation.Slides;
                    slide  = slides.AddSlide(i + 1, customLayout);

                    // Add title
                    objText           = slide.Shapes[1].TextFrame.TextRange;
                    objText.Text      = pptTitle;
                    objText.Font.Name = "Arial";
                    objText.Font.Size = 32;

                    PowerPoint.Shape shape = slide.Shapes[2];
                    slide.Shapes.AddPicture(observableCollection[i].Image_Path, MsoTriState.msoFalse, MsoTriState.msoTrue, shape.Left, shape.Top, shape.Width, shape.Height);

                    slide.NotesPage.Shapes[2].TextFrame.TextRange.Text = "This document is created by DigiDental.";
                }
                pptPresentation.SaveAs(fileName, PpSaveAsFileType.ppSaveAsDefault, MsoTriState.msoTrue);
                //pptApplication.Quit();

                return(true);
            }
            catch (Exception ex)
            {
                ErrorLog.ErrorMessageOutput(ex.ToString());
                return(false);
            }
        }
Exemple #40
0
    public bool WriteOnSlide()
    {
        var    resultado = false;
        string filePath  = System.Web.HttpContext.Current.Server.MapPath("~/TemplatePPT/Plantilla1.pptx");

        try
        {
            Application   pptApplication      = new Application();
            Presentations multi_presentations = pptApplication.Presentations;
            Presentation  presentation        = multi_presentations.Open(filePath, MsoTriState.msoFalse, MsoTriState.msoFalse, MsoTriState.msoFalse);
            CustomLayout  customLayout        = presentation.SlideMaster.CustomLayouts[PpSlideLayout.ppLayoutText];

            Slides slides = presentation.Slides;
            Microsoft.Office.Interop.PowerPoint.Shapes shapes = presentation.Slides[1].Shapes;
            TextRange objText;

            slides = presentation.Slides;

            var text1 = "Escribiendo en el titulo: " + DateTime.Now.ToString();
            var text2 = "Descripcion PPT: " + DateTime.Now.ToString();

            objText           = shapes[1].TextFrame.TextRange;
            objText.Text      = text1;
            objText.Font.Name = "Arial";
            objText.Font.Size = 32;

            objText           = shapes[2].TextFrame.TextRange;
            objText.Text      = text2;
            objText.Font.Name = "Arial";
            objText.Font.Size = 28;

            ReadWriteTxt(filePath);
            presentation.SaveAs(filePath, PpSaveAsFileType.ppSaveAsDefault, Microsoft.Office.Core.MsoTriState.msoTrue);
            presentation.Close();
            pptApplication.Quit();
            resultado = true;
        }
        catch (Exception ex)
        {
        }
        return(resultado);
    }
Exemple #41
0
        private static bool CreatePresentation()
        {
            var resultado = false;

            try
            {
                Application pptApplication = new Application();

                Slides    slides;
                _Slide    slide;
                TextRange objText;

                Presentation pptPresentation = pptApplication.Presentations.Add(MsoTriState.msoFalse);
                CustomLayout customLayout    = pptPresentation.SlideMaster.CustomLayouts[PpSlideLayout.ppLayoutText];

                slides = pptPresentation.Slides;
                slide  = slides.AddSlide(1, customLayout);

                objText           = slide.Shapes[1].TextFrame.TextRange;
                objText.Text      = "Escriba un titulo";
                objText.Font.Name = "Arial";
                objText.Font.Size = 32;

                objText           = slide.Shapes[2].TextFrame.TextRange;
                objText.Text      = "Escriba un contenido";
                objText.Font.Size = 28;

                slide.NotesPage.Shapes[2].TextFrame.TextRange.Text = "Presentacion creada desde C#, Efrain Mejias C";

                pptPresentation.SaveAs(CurrentDirectory() + fileName, PpSaveAsFileType.ppSaveAsDefault, MsoTriState.msoTrue);
                pptPresentation.Close();
                pptApplication.Quit();
                resultado = true;
            }
            catch (Exception ex)
            {
                WriteException(ex.ToString());
            }

            return(resultado);
        }
        public CustomTitleBar( Color backGroundColor, string titleValue, Color titleColor, string backButtonTitle )
        {
            //Cross.IDeviceSpec spec = DependencyService.Get<Cross.IDeviceSpec>();
            int titlebarHeight = (int)App.screenHeight * 10 / 100;//(int)spec.ScreenHeight * 10 / 100;
            int titlebarWidth = (int)App.screenWidth;//(int)spec.ScreenWidth;
            this.BackgroundColor = backGroundColor;

            masterLayout = new CustomLayout();
            masterLayout.HeightRequest = titlebarHeight;
            masterLayout.WidthRequest = titlebarWidth;
            masterLayout.BackgroundColor = backGroundColor;

            ImageButton menuButton = new ImageButton();
            menuButton.Source = Device.OnPlatform("menu.png", "menu.png", "//Assets//menu.png");
            menuButton.HeightRequest = 50;
            menuButton.WidthRequest = 50;


            imageAreaTapGestureRecognizer = new TapGestureRecognizer();
            menuButton.GestureRecognizers.Add(imageAreaTapGestureRecognizer);


            title = new Label();
            title.Text = titleValue;
            title.FontSize = 15;
            title.TextColor = Color.Black;

            Image logo = new Image();
            logo.Source = Device.OnPlatform("logo.png", "logo.png", "//Assets//logo.png");
            logo.WidthRequest = App.screenWidth; //spec.ScreenWidth;
            logo.HeightRequest = titlebarHeight;




            masterLayout.AddChildToLayout(logo, 0, 0, (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest); 
            masterLayout.AddChildToLayout(menuButton, 2, 10, (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest);

            Content = masterLayout;

        }
Exemple #43
0
    private CustomLayout CheckParent()
    {
        CustomLayout parentLayout = transform.parent.GetComponent <CustomLayout>();

        if (parentLayout == null)
        {
            parentLayout = Instantiate(m_Prefab, transform.parent).GetComponent <CustomLayout>();
            parentLayout.transform.SetSiblingIndex(transform.GetSiblingIndex());
            if (LayoutGroup is HorizontalLayoutGroup)
            {
                parentLayout.Set(Layout.Vertical);
            }
            else
            {
                parentLayout.Set(Layout.Horizontal);
            }

            transform.SetParent(parentLayout.LayoutGroup.transform);
        }
        return(parentLayout);
    }
        public LoginGooglePage()
        {
            CustomLayout masterLayout = new CustomLayout();
            masterLayout.BackgroundColor = Color.Gray;

            CustomEntry paswordEntry = new CustomEntry
            {
                Placeholder = "Password"
            };

            CustomEntry confirmPaswordEntry = new CustomEntry
            {
                Placeholder = "Confirm Password"
            };


            Button submitButton = new Button
            {
                Text = "Submit",
                TextColor = Color.Black,
                BorderColor = Color.Black,
                BorderWidth = 2
            };


            paswordEntry.WidthRequest = App.screenWidth * 80 / 100;
            confirmPaswordEntry.WidthRequest = App.screenWidth * 80 / 100;
            submitButton.WidthRequest = App.screenWidth * 40 / 100;


            masterLayout.AddChildToLayout(paswordEntry, 10, 30);
            masterLayout.AddChildToLayout(confirmPaswordEntry, 10, 45);
            masterLayout.AddChildToLayout(submitButton, 30, 60);

            submitButton.Clicked += OnSubmitButtonClicked;

            Content = masterLayout;
        }
        public CustomListMenu(CustomLayout containerLayout, List<PurposeColor.CustomControls.CustomListViewItem> itemSource)
        {
            pageContainedLayout = containerLayout;
            this.BackgroundColor = Color.Transparent;
            masterLayout = new CustomLayout();
            masterLayout.BackgroundColor = Color.Transparent;

            #region LIST VIEW
            listView = new ListView();
            listView.ItemsSource = itemSource;
            listView.ItemTemplate = new DataTemplate(typeof(PurposeColor.CustomControls.CustomListViewCellItem));
			listView.WidthRequest = Device.OnPlatform(App.screenWidth * .28, App.screenWidth * .30, App.screenWidth * .30);
			listView.HeightRequest = Device.OnPlatform(itemSource.Count * 44,itemSource.Count * 45, itemSource.Count * 45);
			listView.SeparatorVisibility = SeparatorVisibility.None;
            listView.HorizontalOptions = LayoutOptions.Center;
            listView.VerticalOptions = LayoutOptions.Center;
            listView.BackgroundColor = Color.Transparent;
            listView.Opacity = 1;

            #endregion

            Image bg = new Image
            {
				WidthRequest = Device.OnPlatform((App.screenWidth * .30) + 2, (App.screenWidth * .31) + 2, (App.screenWidth * .31) + 2),
				HeightRequest = Device.OnPlatform(itemSource.Count * 48,itemSource.Count * 50, itemSource.Count * 50),
                Source = Device.OnPlatform("arrow_box.png", "arrow_box.png", "//Assets//arrow_box.png"),
                VerticalOptions = LayoutOptions.Start,
                Aspect = Aspect.Fill
            };

            masterLayout.AddChildToLayout(bg, 0, 0);
            masterLayout.AddChildToLayout(listView, 1, 2);
            masterLayout.HeightRequest = itemSource.Count * 65;
            masterLayout.WidthRequest = App.screenWidth * .34;

            Content = new StackLayout { Padding = 1, BackgroundColor = Color.Transparent, Children = { masterLayout }, HeightRequest = itemSource.Count * 70 };//App.screenHeight * .21
        }
		public CommunityMediaViewer ( List<PurposeColor.Constants.MediaDetails> mediaList )
		{
			NavigationPage.SetHasNavigationBar (this, false);
			masterLayout = new CustomLayout ();
			masterLayout.BackgroundColor = Color.Black;// Color.FromRgb(244, 244, 244);
			masterScroll = new ScrollView ();
			masterScroll.BackgroundColor = Color.Black;//Color.FromRgb(244, 244, 244);
			progressBar = DependencyService.Get<IProgressBar> ();

			mainTitleBar = new PurposeColorTitleBar (Color.FromRgb (8, 135, 224), "Purpose Color", Color.Black, "back", true);
			subTitleBar = new PurposeColorSubTitleBar (Constants.SUB_TITLE_BG_COLOR, "Gem Media Viewer", false);
			subTitleBar.BackButtonTapRecognizer.Tapped += async (object sender, EventArgs e) => {
				try {
					await Navigation.PopAsync ();
				} catch (Exception) {
				}
			};

			mainTitleBar.imageAreaTapGestureRecognizer.Tapped += (object sender, EventArgs e) => 
			{
				App.masterPage.IsPresented = !App.masterPage.IsPresented;
			};
				

			masterStack = new CustomLayout ();
			masterStack.BackgroundColor = Color.Transparent;
			masterStack.HorizontalOptions = LayoutOptions.Center;

			StackLayout bottomAndLowerControllStack = new StackLayout {
				Orientation = StackOrientation.Vertical,
				BackgroundColor = Color.Transparent,
				Spacing = 1,
				Padding = new Thickness (0, 5, 0, 5),
				WidthRequest = App.screenWidth,
			};


			ScrollView imgScrollView = new ScrollView ();
			imgScrollView.Orientation = ScrollOrientation.Horizontal;

			StackLayout horizmgConatiner = new StackLayout ();
			horizmgConatiner.Orientation = StackOrientation.Horizontal;


			CustomImageButton nextImg = new CustomImageButton ();
			nextImg.ImageName = "next.png";
			nextImg.WidthRequest = 40;
			nextImg.HeightRequest = 65;
				
			nextImg.Clicked += async (object sender, EventArgs e) => 
			{

				double curX = imgScrollView.ScrollX;
				double imgWidth = App.screenWidth * 100 / 100;

				if( Device.OS == TargetPlatform.iOS )
				{
					if( curX + imgWidth + 15 < imgScrollView.ContentSize.Width )
						await imgScrollView.ScrollToAsync( curX + imgWidth , 0, true );
				}
				else
				{
					await imgScrollView.ScrollToAsync( curX + imgWidth , 0, true );
				}
					
			};


			CustomImageButton prevImg = new CustomImageButton ();
			prevImg.ImageName = "prev.png";
			prevImg.WidthRequest = 40;
			prevImg.HeightRequest = 65;
			prevImg.Clicked += async (object sender, EventArgs e) => 
			{
				double curX = imgScrollView.ScrollX;
				double imgWidth = App.screenWidth * 90 / 100;
				if( curX > 0 )
				await imgScrollView.ScrollToAsync( curX - App.screenWidth , 0, true );
			};


			#region MEDIA LIST

			if (mediaList != null) 
			{
				foreach (var item in mediaList) 
				{
					TapGestureRecognizer videoTap = new TapGestureRecognizer ();
					videoTap.Tapped += OnActionVideoTapped;

					Image img = new Image ();
					bool isValidUrl = ( item.Url != null && !string.IsNullOrEmpty ( item.Url )) ? true : false;
					string source = (isValidUrl) ? item.Url : Device.OnPlatform ("noimage.png", "noimage.png", "//Assets//noimage.png");
					string fileExtenstion = Path.GetExtension (source);
					bool isImage = (fileExtenstion == ".png" || fileExtenstion == ".jpg" || fileExtenstion == ".jpeg") ? true : false;
					img.WidthRequest = App.screenWidth;
					img.HeightRequest = App.screenWidth;
					img.Aspect = Aspect.AspectFill;
					img.ClassId = null;
					if (item != null && item.MediaType == "mp4") 
					{
						img.ClassId = source;
						source = Constants.SERVICE_BASE_URL + item.ImageName;
					}
					else if ( item != null &&  item.MediaType == "aac")
					{
						img.ClassId = source;
						source = Device.OnPlatform ("audio.png", "audio.png", "//Assets//audio.png");
					}
					else if ( item != null &&  item.MediaType == "3gpp")
					{
						img.ClassId = source;
						source = Constants.SERVICE_BASE_URL + item.ImageName;
					}
					else if ( item != null && item.MediaType == "wav")
					{
						img.ClassId = source;
						source = Device.OnPlatform ("audio.png", "audio.png", "//Assets//audio.png");
					}
					img.Source = source;
					img.GestureRecognizers.Add (videoTap);
					var indicator = new ActivityIndicator { Color = new Color (.5), };
					indicator.SetBinding (ActivityIndicator.IsRunningProperty, "IsLoading");
					indicator.BindingContext = img;
					masterStack.AddChildToLayout (indicator, 40, 30);

					if (item != null && ( item.MediaType == "mp4" || item.MediaType == "3gpp" ) )
					{
						Grid grid = new Grid
						{
							VerticalOptions = LayoutOptions.FillAndExpand,
							HorizontalOptions = LayoutOptions.FillAndExpand,
							RowDefinitions = 
							{
								new RowDefinition { Height = new GridLength( img.WidthRequest / 3 ) },
								new RowDefinition { Height = new GridLength( img.WidthRequest / 3 ) },
								new RowDefinition { Height = new GridLength( img.WidthRequest / 3 ) },

							},
							ColumnDefinitions = 
							{
								new ColumnDefinition { Width = new GridLength( img.WidthRequest / 3 ) },
								new ColumnDefinition { Width = new GridLength( img.WidthRequest / 3 ) },
								new ColumnDefinition { Width = new GridLength( img.WidthRequest / 3 ) },

							}
						};

						Image play = new Image();
						play.Source = "video_play.png";
						play.Aspect = Aspect.AspectFit;
						play.WidthRequest = 75;
						play.HeightRequest = 75;
						play.HorizontalOptions = LayoutOptions.Center;
						play.VerticalOptions = LayoutOptions.Center;
						play.ClassId =  img.ClassId;
						play.GestureRecognizers.Add(videoTap);

						grid.Children.Add( img, 0, 0 );
						Grid.SetColumnSpan(img, 3);
						Grid.SetRowSpan( img, 3 );
						grid.Children.Add(play, 1, 1);
						horizmgConatiner.Children.Add(grid);
					}
					else
					{
						horizmgConatiner.Children.Add(img);
					}
				}
				imgScrollView.Content = horizmgConatiner;
				bottomAndLowerControllStack.Children.Add (imgScrollView);

			}

			#endregion

			masterStack.AddChildToLayout (bottomAndLowerControllStack, 0, Device.OnPlatform (5, 9, 12));//12
			masterScroll.HeightRequest = App.screenHeight - 20;
			masterScroll.WidthRequest = App.screenWidth;// * 90 / 100;

			StackLayout masterStackLayout = new StackLayout ();
			masterStackLayout.HorizontalOptions = LayoutOptions.Center;
			masterStackLayout.BackgroundColor = Color.Black;
			masterStackLayout.Orientation = StackOrientation.Vertical;
			masterStackLayout.Children.Add (masterStack);
			masterScroll.Content = masterStackLayout;
			masterLayout.AddChildToLayout (mainTitleBar, 0, 0);
			masterLayout.AddChildToLayout (subTitleBar, 0, Device.OnPlatform (9, 10, 10));
			masterLayout.AddChildToLayout (masterScroll, 0, 18);
			masterLayout.AddChildToLayout (prevImg, Device.OnPlatform( -2, -2, 0 ), 50);
			masterLayout.AddChildToLayout (nextImg, 90, 50);
			Content = masterLayout;
		}
		public void Dispose ()
		{
			masterScroll = null;
			Content = null;
			masterLayout = null;
			progressBar = null;
			masterStack = null;
			this.Content = null;
			GC.Collect ();
		}
        public void Dispose()
        {
            this.forgotPasswordLabel = null;
            this.userNameEntry = null;
            this.passwordEntry = null;
            this.indicator = null;
            this.googleSignInButton = null;
            this.subTitleBar = null;
            this.faceBookSignInButton = null;
            this.signInButton = null;
            this.subTitleBar = null;
            this.masterLayout = null;

            GC.Collect();
        }
        public LogInPage()
        {
			App.IsLoggedIn = false;
            NavigationPage.SetHasNavigationBar(this, false);
            masterLayout = new CustomLayout();
            masterLayout.BackgroundColor = Constants.PAGE_BG_COLOR_LIGHT_GRAY;
            screenHeight = App.screenHeight;
            screenWidth = App.screenWidth;
            PurposeColorTitleBar mainTitleBar = new PurposeColorTitleBar(Color.FromRgb(8, 135, 224), "Purpose Color", Color.Black, "back", true);
            mainTitleBar.imageAreaTapGestureRecognizer.Tapped += imageAreaTapGestureRecognizer_Tapped;
            subTitleBar = new PurposeColorBlueSubTitleBar(Constants.SUB_TITLE_BG_COLOR, "               Sign In", true, true);
            subTitleBar.NextButtonTapRecognizer.Tapped += (s, e) =>
            {
                OnSignInButtonClicked(signInButton, null);
            };
            subTitleBar.BackButtonTapRecognizer.Tapped += (s, e) =>
            {
                App.masterPage.IsPresented = !App.masterPage.IsPresented;
            };

            userNameEntry = new CustomEntry
            {
                Placeholder = "Username",
                Keyboard = Keyboard.Email,
                HeightRequest = Device.OnPlatform(50, 50,75)
               // Text = "apptester" // for testing only // remove after testing
            };

            passwordEntry = new CustomEntry
            {
                Placeholder = "Password",
                IsPassword = true,
                HeightRequest = Device.OnPlatform(50, 50, 75)
            };

            signInButton = new Button
            {
                Text = "Sign in",
                TextColor = Color.White,
                BorderColor = Color.Transparent,
                BorderWidth = 0,
                BackgroundColor = Constants.BLUE_BG_COLOR
                //HeightRequest = 50
            };

            TapGestureRecognizer forgotPasswordTap = new TapGestureRecognizer();
            forgotPasswordLabel = new Label
            {
                Text = "Forgot password",
                TextColor = Constants.BLUE_BG_COLOR,
                BackgroundColor = Color.Transparent,
                FontSize = Device.OnPlatform(12,12,15),
                HeightRequest = Device.OnPlatform(15, 25, 25),
            };

            forgotPasswordLabel.GestureRecognizers.Add(forgotPasswordTap);
            forgotPasswordTap.Tapped += (s, e) =>
            {
                try
                {
                    Navigation.PushAsync(new ForgotPassword());
                }
                catch (Exception)
                {
                }
            };

            TapGestureRecognizer registerTap = new TapGestureRecognizer();
            registerLabel = new Label
            {
                Text = "Sign up with us",
                TextColor = Constants.BLUE_BG_COLOR,
                BackgroundColor = Color.Transparent,
                FontSize = Device.OnPlatform(12, 12, 15),
                HeightRequest = Device.OnPlatform(15, 25, 25),
            };
            registerLabel.GestureRecognizers.Add(registerTap);
            registerTap.Tapped += (s, e) =>
            {
                try
                {
                    Navigation.PushModalAsync(new RegistrationPageOne());
                }
                catch (Exception)
                {
                }
            };

            googleSignInButton = new Button
            {
                Text = "Sign in with Google",
                TextColor = Color.White,
                BorderColor = Color.Transparent,
                BorderWidth = 0,
                BackgroundColor = Constants.BLUE_BG_COLOR
            };

            faceBookSignInButton = new Button
            {
                Text = "Sign in with Facebook",
                TextColor = Color.White,
                BorderColor = Color.Transparent,
                BorderWidth = 0,
                BackgroundColor = Constants.BLUE_BG_COLOR
            };

            indicator = new ActivityIndicator();
            indicator.IsRunning = true;
            indicator.IsEnabled = true;
            indicator.IsVisible = false;

            userNameEntry.WidthRequest = screenWidth * 80 / 100;
            passwordEntry.WidthRequest = screenWidth * 80 / 100;
            signInButton.WidthRequest = screenWidth * 80 / 100;
            googleSignInButton.WidthRequest = screenWidth * 80 / 100;
            faceBookSignInButton.WidthRequest = screenWidth * 80 / 100;

            //imgsignInButton.WidthRequest = deviceSpec.ScreenWidth * 10 / 100;
            //imgsignInButton.HeightRequest = deviceSpec.ScreenHeight * 5 / 100;

            masterLayout.AddChildToLayout(mainTitleBar, 0, 0);
            masterLayout.AddChildToLayout(subTitleBar, 0, Device.OnPlatform(9, 10, 10));
            masterLayout.AddChildToLayout(userNameEntry, 10, Device.OnPlatform(30, 30, 30));
            masterLayout.AddChildToLayout(passwordEntry, 10, Device.OnPlatform(40, 40, 38));
            masterLayout.AddChildToLayout(signInButton, 10, Device.OnPlatform(50, 50, 47));
            masterLayout.AddChildToLayout(forgotPasswordLabel, Device.OnPlatform(11, 11, 13), Device.OnPlatform(60,59,47));
            masterLayout.AddChildToLayout(registerLabel, Device.OnPlatform(62, 66, 65), Device.OnPlatform(60,59,47));
            
           // masterLayout.AddChildToLayout(googleSignInButton, 10, Device.OnPlatform(65,65,62));
           // masterLayout.AddChildToLayout(faceBookSignInButton, 10, Device.OnPlatform(75, 75, 70));

            googleSignInButton.Clicked += OnGoogleSignInButtonClicked;
            faceBookSignInButton.Clicked += faceBookSignInButton_Clicked;
            signInButton.Clicked += OnSignInButtonClicked;

            Content = masterLayout;
        }
        public GemsCell()
        {

            CustomLayout absTopLayout = new CustomLayout();
            absTopLayout.BackgroundColor = Color.FromRgb(230, 255, 254);
            IDeviceSpec deviceSpec = DependencyService.Get<IDeviceSpec>();

            Image profileImage = new Image();
            profileImage.WidthRequest = deviceSpec.ScreenWidth * 15 / 100;
            profileImage.HeightRequest = deviceSpec.ScreenHeight * 9 / 100;
            profileImage.SetBinding(Image.SourceProperty, "ProfilePhoto");
            profileImage.Aspect = Aspect.Fill;

            Label profileName = new Label();
            profileName.SetBinding( Label.TextProperty, "Name" );
            profileName.TextColor = Color.Blue;

            Label dateInfo = new Label();
            dateInfo.SetBinding( Label.TextProperty, "DateInfo" );
            dateInfo.TextColor = Color.Gray;

            Label gemInfo = new Label();
            gemInfo.TextColor = Color.Black;
            gemInfo.SetBinding(Label.TextProperty, "GemInfo");
            gemInfo.WidthRequest = deviceSpec.ScreenWidth * 90 / 100;


            Image gemImage = new Image();
            gemImage.WidthRequest = deviceSpec.ScreenWidth * 90 / 100;
            gemImage.HeightRequest = deviceSpec.ScreenHeight * 25 / 100;
            gemImage.SetBinding( Image.SourceProperty, "GemImage" );
            gemImage.Aspect = Aspect.Fill;

           /* Button seeMore = new Button();
            seeMore.Text = "see more";
            seeMore.FontSize = Device.OnPlatform(12, 12, 18);
            seeMore.TextColor = Color.Blue;
            seeMore.BackgroundColor = Color.Transparent;
            seeMore.BorderColor = Color.Transparent;
            seeMore.BorderWidth = 0;
            seeMore.SetBinding(Button.ClassIdProperty, "Name");
            seeMore.SetBinding( Button.IsVisibleProperty, "IsSeeMoreVisible" );
            seeMore.Clicked += (object sender, EventArgs e) =>
            {
                Button btn = sender as Button;
                Gems selGem = GemsPage.gemsSource.FirstOrDefault(i => i.Name == btn.ClassId);
                if( selGem != null )
                {
                    App.Navigator.PushModalAsync( new GemsDetailedView( selGem.GemInfo, selGem.GemImage ) );
                }
            };*/



            StackLayout masterStakLayout = new StackLayout();
            masterStakLayout.Orientation = StackOrientation.Vertical;


            StackLayout gemInfoImageLayout = new StackLayout();
            absTopLayout.WidthRequest = deviceSpec.ScreenWidth;


            absTopLayout.AddChildToLayout(profileImage, 5, 5);
            absTopLayout.AddChildToLayout(profileName, 23, 5);
            absTopLayout.AddChildToLayout( dateInfo, 23, 8 );

            gemInfoImageLayout.Children.Add( gemInfo );
            gemInfoImageLayout.Children.Add( gemImage );


            masterStakLayout.Children.Add( absTopLayout );
            masterStakLayout.Children.Add( gemInfoImageLayout );
            this.View = masterStakLayout;

        }
		public SourceChooser(CustomLayout pageContainer, string type, ProfileSettingsPage parentObject)
		{
			CustomLayout masterLayout = new CustomLayout();
			masterLayout.BackgroundColor = Color.Transparent;
			//IDeviceSpec deviceSpec = DependencyService.Get<IDeviceSpec>();
			double screenWidth = App.screenWidth;
			double screenHeight = App.screenHeight;
			PageContainer = pageContainer;

			callerObject = parentObject;

			StackLayout layout = new StackLayout();
			layout.BackgroundColor = Color.Black;
			layout.Opacity = .6;
			layout.WidthRequest = screenWidth;
			layout.HeightRequest = screenHeight;

			TapGestureRecognizer emptyAreaTapGestureRecognizer = new TapGestureRecognizer();
			emptyAreaTapGestureRecognizer.Tapped += (s, e) =>
			{

				View pickView = PageContainer.Children.FirstOrDefault(pick => pick.ClassId == "mediachooser");
				PageContainer.Children.Remove(pickView);
				pickView = null;

			};
			layout.GestureRecognizers.Add(emptyAreaTapGestureRecognizer);

			CustomImageButton imageButton = new CustomImageButton();
			imageButton.ImageName = Device.OnPlatform("photoCamera_icon.png", "photoCamera_icon.png", @"/Assets/photoCamera_icon.png");
			imageButton.WidthRequest = screenWidth * 20 / 100;
			imageButton.HeightRequest = screenHeight * 10 / 100;
			imageButton.ClassId = type;
			imageButton.Clicked += OnImageButtonClicked;

			CustomImageButton selectFromGalleryButton = new CustomImageButton();
			selectFromGalleryButton.ImageName = Device.OnPlatform("image.png", "image.png", @"/Assets/image.png");
			selectFromGalleryButton.WidthRequest = screenWidth * 20 / 100;
			selectFromGalleryButton.HeightRequest = screenHeight * 10 / 100;
			selectFromGalleryButton.ClassId = type;
			selectFromGalleryButton.Clicked += SelectFromGalleryButtonClicked;

			masterLayout.AddChildToLayout(layout, 0, 0);
			masterLayout.AddChildToLayout(imageButton, 40, 40);
			masterLayout.AddChildToLayout(selectFromGalleryButton, 40, 60);

			this.BackgroundColor = Color.Transparent;



			Content = masterLayout;
		}
		async Task<bool> AddToScrollView(CustomGemItemModel gemModel)
		{
			try {
				CustomLayout gemLayout = null;
				Image image = null;
				StackLayout bgStack = null;
				Label detailsLabel = null;
				Label groupTitleLabel = null;

				gemLayout = new CustomLayout ();
				gemLayout.BackgroundColor = Color.FromRgb(219,221,221);
				gemLayout.WidthRequest = App.screenWidth;
				gemLayout.Padding = new Thickness(0,0,0,App.screenHeight * .04);
				detailsLabel = new Label ();
				detailsLabel.Text = gemModel.Description;
				detailsLabel.TextColor = Color.White; // Color.FromRgb(8, 135, 224);//Color.FromRgb(8, 159, 245);
				detailsLabel.FontFamily = Constants.HELVERTICA_NEUE_LT_STD;
				detailsLabel.FontSize = 18;
				detailsLabel.WidthRequest = App.screenWidth - (App.screenWidth *.01);
				detailsLabel.HorizontalOptions = LayoutOptions.Center;
				detailsLabel.YAlign = TextAlignment.Center;
				detailsLabel.XAlign = TextAlignment.Center;

				bgStack = new StackLayout ();
				bgStack.WidthRequest = App.screenWidth;
				bgStack.HeightRequest = 85;
				bgStack.BackgroundColor = Color.Black;//Color.FromRgb(220, 220, 220);
				bgStack.Opacity = .2;
				bgStack.ClassId = gemModel.ID;

				if(!string.IsNullOrEmpty(detailsLabel.Text))
				{
					int textleng = detailsLabel.Text.Length;
				}

				image = new Image {
					Aspect = Aspect.AspectFill, //Aspect.Fill,
					HorizontalOptions = LayoutOptions.Center,
					VerticalOptions = LayoutOptions.Center,
					WidthRequest = App.screenWidth,
					HeightRequest = (App.screenHeight * .35),
					Rotation= 0,
					Source = gemModel.Source
				};

				Image nextBtn = new Image
				{
					Source = "roundNextBtn.png",
					WidthRequest = App.screenWidth * .1,
					HeightRequest = App.screenWidth * .1,
					ClassId = gemModel.ID.ToString()
				};

				TapGestureRecognizer DetailsTapgesture = null;
				DetailsTapgesture = new TapGestureRecognizer();
				DetailsTapgesture.Tapped += DetailsTapgesture_Tapped;
				nextBtn.GestureRecognizers.Add(DetailsTapgesture);

				if (previousTitle == null || !string.IsNullOrEmpty(gemModel.GroupTitle) && gemModel.GroupTitle != previousTitle)
				{
					groupTitleLabel = new Label
					{
						FontFamily = Constants.HELVERTICA_NEUE_LT_STD,
						FontSize = 19,
						YAlign = TextAlignment.Start,
						VerticalOptions = LayoutOptions.Center,
						TextColor = Color.White,
						Text = "  " + gemModel.GroupTitle.Trim()
					};
					StackLayout titleHolder = new StackLayout{
						Children={groupTitleLabel},
						BackgroundColor = Color.FromRgb(111, 199, 251), //Color.FromRgb(59,164,222),//Color.FromRgb(88,168,6), // Color.FromRgb(111, 199, 251),
						Padding = 0,
						Orientation = StackOrientation.Horizontal,
						WidthRequest= App.screenWidth
					};
					gemLayout.AddChildToLayout (titleHolder, 0, 0);
					gemLayout.AddChildToLayout (image, 0, 4);
					gemLayout.AddChildToLayout (bgStack, 0, 16);//16 - appear @ center of img. 26 - text appear at bottom corner of img.
					gemLayout.AddChildToLayout (detailsLabel, 1, 16);
					gemLayout.AddChildToLayout (nextBtn, 47, 23); // btn width = 1% of width.

				}else
				{
					gemLayout.AddChildToLayout (image, 0, 0);
					gemLayout.AddChildToLayout (bgStack, 0, 12);// 12 - aliended center to img. // 22 - align to bottom of img.
					gemLayout.AddChildToLayout (detailsLabel, 1, 12);
					gemLayout.AddChildToLayout (nextBtn, 47, 19);
				}

				gemLayout.ClassId = gemModel.ID;
				gemLayout.GestureRecognizers.Add(DetailsTapgesture);
				bgStack.GestureRecognizers.Add(DetailsTapgesture);

				if (!string.IsNullOrEmpty(gemModel.GroupTitle)) {
					previousTitle = gemModel.GroupTitle.Trim();
				}


				listViewContainer.Children.Add(gemLayout);

				gemModel = null; // to clear mem.

				return true;
			} catch (Exception ex) {
				var test = ex.Message;
			}

			return false;
		}
        public CommunityGemsPage()
        {
            NavigationPage.SetHasNavigationBar(this, false);
            CustomLayout masterLayout = new CustomLayout();
            masterLayout.BackgroundColor = Color.FromRgb(230, 255, 254);

            PurposeColorTitleBar titleBar = new PurposeColorTitleBar(Color.FromRgb(8, 137, 216), "Purpose Color", Color.Black, "back");
            PurposeColorSubTitleBar subTitleBar = new PurposeColorSubTitleBar(Color.FromRgb(12, 113, 210), "Emotional Awareness");

            gemsSource = new List<Gems>();

            Gems gemItems = new Gems();
            gemItems.ArrowImage = "";
            gemItems.DateInfo = "2015 Janury 30";
            gemItems.GemImage = Device.OnPlatform("manali.jpg", "manali.jpg", "//Assets//manali.jpg");
            gemItems.Name = "Lance Clusner";
            gemItems.ProfilePhoto = Device.OnPlatform("avatar.jpg", "avatar.jpg", "//Assets//avatar.jpg"); 
            gemItems.GemInfo = "This is just a dummy page to check how it displays in mobile devices. below picture is taken from manali. Manali is a high-altitude Himalayan resort town in India’s northern Himachal Pradesh state. It has a reputation as a backpacking center and honeymoon destination. Set on the Beas River, it’s a gateway for skiing in the Solang Valley and trekking in Parvati Valley. It's also a jumping-off point for paragliding, rafting and mountaineering in the Pir Panjal mountains, home to 4,000m-high Rohtang Pass..Manali is a high-altitude Himalayan resort town in India’s northern Himachal Pradesh state. It has a reputation as a backpacking center and honeymoon destination. Set on the Beas River, it’s a gateway for skiing in the Solang Valley and trekking in Parvati Valley. It's also a jumping-off point for paragliding, rafting and mountaineering in the Pir Panjal mountains, home to 4,000m-high Rohtang Pass.Manali is a high-altitude Himalayan resort town in India’s northern Himachal Pradesh state. It has a reputation as a backpacking center and honeymoon destination. Set on the Beas River, it’s a gateway for skiing in the Solang Valley and trekking in Parvati Valley. It's also a jumping-off point for paragliding, rafting and mountaineering in the Pir Panjal mountains, home to 4,000m-high Rohtang Pass..Manali is a high-altitude Himalayan resort town in India’s northern Himachal Pradesh state. It has a reputation as a backpacking center and honeymoon destination. Set on the Beas River, it’s a gateway for skiing in the Solang Valley and trekking in Parvati Valley. It's also a jumping-off point for paragliding, rafting and mountaineering in the Pir Panjal mountains, home to 4,000m-high Rohtang Pass.Manali is a high-altitude Himalayan resort town in India’s northern Himachal Pradesh state. It has a reputation as a backpacking center and honeymoon destination. Set on the Beas River, it’s a gateway for skiing in the Solang Valley and trekking in Parvati Valley. It's also a jumping-off point for paragliding, rafting and mountaineering in the Pir Panjal mountains, home to 4,000m-high Rohtang Pass..Manali is a high-altitude Himalayan resort town in India’s northern Himachal Pradesh state. It has a reputation as a backpacking center and honeymoon destination. Set on the Beas River, it’s a gateway for skiing in the Solang Valley and trekking in Parvati Valley. It's also a jumping-off point for paragliding, rafting and mountaineering in the Pir Panjal mountains, home to 4,000m-high Rohtang Pass..Manali is a high-altitude Himalayan resort town in India’s northern Himachal Pradesh state. It has a reputation as a backpacking center and honeymoon destination. Set on the Beas River, it’s a gateway for skiing in the Solang Valley and trekking in Parvati Valley. It's also a jumping-off point for paragliding, rafting and mountaineering in the Pir Panjal mountains, home to 4,000m-high Rohtang Pass.Manali is a high-altitude Himalayan resort town in India’s northern Himachal Pradesh state. It has a reputation as a backpacking center and honeymoon destination. Set on the Beas River, it’s a gateway for skiing in the Solang Valley and trekking in Parvati Valley. It's also a jumping-off point for paragliding, rafting and mountaineering in the Pir Panjal mountains, home to 4,000m-high Rohtang Pass.Manali is a high-altitude Himalayan resort town in India’s northern Himachal Pradesh state. It has a reputation as a backpacking center and honeymoon destination. Set on the Beas River, it’s a gateway for skiing in the Solang Valley and trekking in Parvati Valley. It's also a jumping-off point for paragliding, rafting and mountaineering in the Pir Panjal mountains, home to 4,000m-high Rohtang Pass.";


            Gems gemItem2 = new Gems();
            gemItem2.ArrowImage = "";
            gemItem2.DateInfo = "2015 Janury 30";
            gemItem2.GemImage = Device.OnPlatform("manali.jpg", "manali.jpg", "//Assets//manali.jpg");
            gemItem2.Name = "Virender Sehwag";
            gemItem2.ProfilePhoto = Device.OnPlatform("avatar.jpg", "avatar.jpg", "//Assets//avatar.jpg"); 
            gemItem2.GemInfo = "This is just a dummy page to check how ";



            Gems gemItem3 = new Gems();
            gemItem3.ArrowImage = "";
            gemItem3.DateInfo = "2015 Janury 30";
            gemItem3.GemImage = Device.OnPlatform("manali.jpg", "manali.jpg", "//Assets//manali.jpg");
            gemItem3.Name = "Brian lara";
            gemItem3.ProfilePhoto = Device.OnPlatform("avatar.jpg", "avatar.jpg", "//Assets//avatar.jpg"); 
            gemItem3.GemInfo = "This is just a dummy page to check how This is just a dummy page to check how This is just a dummy page to check how This is just a dummy page to check how This is just a dummy page to check how This is just a dummy page to check how This is just a dummy page to check how ";

            for (int index = 0; index < 50; index++ )
            {
                gemsSource.Add(gemItems);
                gemsSource.Add(gemItem2);
                gemsSource.Add(gemItem3);
                gemsSource.Add(gemItems);
            }


            ListView gemsList = new ListView();
            gemsList.ItemTemplate = new DataTemplate(typeof(GemsCell));
            gemsList.SeparatorVisibility = SeparatorVisibility.None;
            gemsList.BackgroundColor = Color.FromRgb(230, 255, 254);
            gemsList.ItemsSource = gemsSource;
            gemsList.HeightRequest = deviceSpec.ScreenHeight * 75 / 100;
            gemsList.HasUnevenRows = true;

            masterLayout.AddChildToLayout(titleBar, 0, 0);
            masterLayout.AddChildToLayout(subTitleBar, 0, 10);
            masterLayout.AddChildToLayout( gemsList, 0, 20 ); 
            Content = masterLayout;
        }
 public void Dispose()
 {
     masterLayout = null;
     BackButtonTapRecognizer = null;
     NextButton = null;
     title = null;
     GC.Collect();
 }
        public AddContentSubTitlebar(Color backGroundColor, string titleValue, bool nextButtonVisible = true, bool backButtonVisible = true)
        {
            int titlebarHeight = (int)App.screenHeight * 7 / 100;
            int titlebarWidth = (int)App.screenWidth;
            this.BackgroundColor = backGroundColor;

            masterLayout = new CustomLayout();
            masterLayout.HeightRequest = titlebarHeight;
            masterLayout.WidthRequest = titlebarWidth;
            masterLayout.BackgroundColor = backGroundColor;

            Image bgImage = new Image();
            bgImage.Source = Device.OnPlatform("top_bg.png", "top_bg.png", "//Assets//top_bg.png");
            bgImage.WidthRequest = App.screenWidth;
            bgImage.HeightRequest = titlebarHeight;
            bgImage.Aspect = Aspect.Fill;

            Image backArrow = new Image();
            backArrow.Source = Device.OnPlatform("arrow_blue.png", "arrow_blue.png", "//Assets//arrow_blue.png");
            backArrow.HeightRequest = App.screenHeight * 4 / 100;
            backArrow.WidthRequest = App.screenWidth * 5 / 100;
            BackButtonTapRecognizer = new TapGestureRecognizer();
            backArrow.GestureRecognizers.Add(BackButtonTapRecognizer);

            //Image imgDivider = new Image();
            //imgDivider.Source = Device.OnPlatform("top_seperate.png", "top_seperate.png", "//Assets//top_seperate.png");
            //imgDivider.HeightRequest = spec.ScreenHeight * 4 / 100;


            NextButton = new Button();
            NextButton.Text = "Next";
            NextButton.FontFamily = Constants.HELVERTICA_NEUE_LT_STD;
            NextButton.FontSize = Device.OnPlatform(12, 12, 17);
            NextButton.TextColor = Color.White;
            NextButton.BackgroundColor = Color.Transparent;
            NextButton.BorderColor = Color.Transparent;
            NextButton.BorderWidth = 0;
            NextButton.WidthRequest = App.screenWidth * Device.OnPlatform(15, 15, 25) / 100;
            NextButton.HeightRequest = App.screenHeight * Device.OnPlatform(5, 5, 8) / 100;


            title = new Label();
            title.Text = titleValue;
            title.FontFamily = Constants.HELVERTICA_NEUE_LT_STD;
            title.FontSize = Device.OnPlatform(17, 20, 22);
            title.TextColor = Color.FromHex("#1e7fd2");

            //Image logo = new Image();
            //logo.Source = Device.OnPlatform("logo.png", "logo.png", "//Assets//logo.png");
            //logo.WidthRequest = spec.ScreenWidth;
            //logo.HeightRequest = titlebarHeight;
            //logo.WidthRequest = spec.ScreenWidth * 70 / 100;
            //logo.HeightRequest = spec.ScreenHeight * 8 / 100;


            // masterLayout.AddChildToLayout(bgImage, 0, 0, (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest);
            masterLayout.AddChildToLayout(title, 20, 22, (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest);


            if (nextButtonVisible)
            {
               // masterLayout.AddChildToLayout(imgDivider, 75, 25, (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest);
                masterLayout.AddChildToLayout(NextButton, Device.OnPlatform(83, 83, 76), Device.OnPlatform(10, 10, -5), (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest);
            }

            if (backButtonVisible)
            {
                masterLayout.AddChildToLayout(backArrow, 3, 25, (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest);
            }

            Content = masterLayout;

        }
        public PurposeColorTitleBar(Color backGroundColor, string titleValue, Color titleColor, string backButtonTitle, bool imageRequired = false)
        {
            Cross.IDeviceSpec spec = DependencyService.Get<Cross.IDeviceSpec>();
            int titlebarHeight = (int)spec.ScreenHeight * 10 / 100;
            int titlebarWidth = (int)spec.ScreenWidth;
            this.BackgroundColor = backGroundColor;

            masterLayout = new CustomLayout();
            masterLayout.HeightRequest = titlebarHeight;
            masterLayout.WidthRequest = titlebarWidth;
            masterLayout.BackgroundColor = backGroundColor;



            Image menuButton = new Image();
            menuButton.Source = Device.OnPlatform("menu.png", "menu.png", "//Assets//menu.png");
            menuButton.HeightRequest = 30;
            menuButton.WidthRequest = 25;


            imageAreaTapGestureRecognizer = new TapGestureRecognizer();
            menuButton.GestureRecognizers.Add(imageAreaTapGestureRecognizer);


            title = new Label();
            title.Text = titleValue;
            title.FontSize = 20;
            title.TextColor = Color.Black;

            Image logo = new Image();
            logo.Source = Device.OnPlatform("logo.png", "logo.png", "//Assets//logo.png");
            logo.WidthRequest = spec.ScreenWidth;
            logo.HeightRequest = titlebarHeight;
            logo.WidthRequest = spec.ScreenWidth * 70 / 100;
            logo.HeightRequest = spec.ScreenHeight * 8 / 100;


			User curUser = App.Settings.GetUser ();

			if (curUser != null) 
			{
				CircleImage userImg = new CircleImage
				{
					Aspect = Aspect.AspectFill,
					HorizontalOptions = LayoutOptions.Center,
					Source =  Constants.SERVICE_BASE_URL + curUser.ProfileImageUrl
				};

				userImg.WidthRequest = 30;
				userImg.HeightRequest = 30;
				if (imageRequired)
				{
					masterLayout.AddChildToLayout(userImg, 88, Device.OnPlatform( 17, 25, 17 ), (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest);
				}

				TapGestureRecognizer profileImgTap = new TapGestureRecognizer ();
				profileImgTap.Tapped += ProfileImgTap_Tapped;
				userImg.GestureRecognizers.Add (profileImgTap);

			}
   

            masterLayout.AddChildToLayout(logo, 5, 5, (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest); 
            masterLayout.AddChildToLayout(menuButton, 2, 25, (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest);



            Content = masterLayout;

        }
		public GemsMainPage()
		{

			NavigationPage.SetHasNavigationBar(this, false);
			masterLayout = new CustomLayout();
			masterLayout.BackgroundColor = Color.FromRgb(244, 244, 244);
			progressBar = DependencyService.Get<IProgressBar>();
			progressBar.ShowProgressbar ("Loading gems..");
			App.isEmotionsListing = false;
			isLoadingFromDetailsPage = false;

			this.Appearing += OnAppearing;
			this.Disappearing += GemsMainPage_Disappearing;
			mainTitleBar = new GemsPageTitleBar(Color.FromRgb(8, 135, 224), "Goal Enabling Materials", Color.White, "", true);
			mainTitleBar.imageAreaTapGestureRecognizer.Tapped += OnImageAreaTapGestureRecognizerTapped;
			masterScroll = new ScrollView();
			masterScroll.WidthRequest = App.screenWidth;
			masterScroll.HeightRequest = App.screenHeight * 85 / 100;
			masterScroll.BackgroundColor = Color.White;
			masterScroll.Scrolled += OnScroll;
			masterScroll.IsClippedToBounds = true;

			masterStack = new StackLayout();
			masterStack.Orientation = StackOrientation.Vertical;
			masterStack.BackgroundColor = Color.White;

			emotionLabel = new Label {
				Text = "EMOTIONS  ", 
				FontFamily = Constants.HELVERTICA_NEUE_LT_STD,
				FontSize = Device.OnPlatform (14, 18, 14),
				HorizontalOptions = LayoutOptions.End,
				VerticalOptions = LayoutOptions.Center,
				TextColor = Color.White,
				WidthRequest = App.screenWidth * .5,
				XAlign = TextAlignment.Center
			};

			emotionsButtion = new StackLayout{
				Children = {
					emotionLabel
				},
				BackgroundColor = Color.FromRgb(8, 159, 245),
				Orientation = StackOrientation.Horizontal,
				WidthRequest = App.screenWidth * .5
				///HorizontalOptions = LayoutOptions.Center
			};

			emotionListingBtnTapgesture = new TapGestureRecognizer ();
			emotionListingBtnTapgesture.Tapped += ShowEmotionsTapGesture_Tapped;
			emotionsButtion.GestureRecognizers.Add (emotionListingBtnTapgesture);

			goalsAndDreamsLabel = new Label {
				Text = "GOALS & DREAMS", 
				FontFamily = Constants.HELVERTICA_NEUE_LT_STD,
				FontSize = Device.OnPlatform (14, 18, 14),
				HorizontalOptions = LayoutOptions.End,
				VerticalOptions = LayoutOptions.Center,
				TextColor = Color.Gray,
				XAlign = TextAlignment.Center
			};

			goalsButton = new StackLayout{
				Children = {
					goalsAndDreamsLabel
				},
				BackgroundColor = Constants.INPUT_GRAY_LINE_COLOR,
				Orientation = StackOrientation.Horizontal,
				WidthRequest = App.screenWidth * .5,
				HorizontalOptions = LayoutOptions.Center,
				Padding = new Thickness(Device.OnPlatform(20,15,20),0,0,0)
			};
			goalsListingBtnTapgesture = new TapGestureRecognizer ();
			goalsListingBtnTapgesture.Tapped += GoalsListingBtnTapgesture_Tapped;
			goalsButton.GestureRecognizers.Add (goalsListingBtnTapgesture);

			masterLayout.AddChildToLayout(mainTitleBar, 0, 0);
			masterLayout.AddChildToLayout(new StackLayout{HeightRequest =  App.screenHeight * 0.08, Orientation = StackOrientation.Horizontal, Spacing = 0, Children = {emotionsButtion, goalsButton}}, 0,Device.OnPlatform(9,10,10));

			progressBar.HideProgressbar ();
		}
        public void Dispose()
        {
            this.masterLayout = null;
            this.name = null;
            this.divider = null;
            this.deleteButton = null;

            GC.Collect();
        }
		public void Dispose()
		{
			masterLayout = null;
			progressBar = null;
			mainTitleBar = null;
			masterScroll = null;
			masterStack = null;
			eventsWithImage = null;
			actionsWithImage = null;
			emotionsButtion = null;
			goalsButton = null;
			goalsAndDreamsLabel = null;
			emotionLabel = null;
			emotionListingBtnTapgesture = null;
			goalsListingBtnTapgesture = null;
			listViewContainer = null;


			//GC.SuppressFinalize(this);
		}
		public void Dispose()
		{
			this.statusEntry = null;
			userInfo = null;
			masterLayout = null;
			galleryInputStackTapRecognizer = null;
			galleryInputStack = null;
			galleryInput = null;
			profilePic = null;
			progressBar = null;
			userProfile = null;
			mainTitleBar = null;
			subTitleBar = null;
			CommunitySharingLabel= null;
			communityShareIcon = null;
			communityStatusBtn = null;
			User currentUser = null;

			GC.Collect();
		}