예제 #1
0
        private void OnDiffRevert(CustomEditor editor)
        {
            // Special case for removed Script from actor
            if (editor is RemovedScriptDummy removed)
            {
                Editor.Log("Reverting removed script changes to prefab (adding it)");

                var actor          = (Actor)Values[0];
                var restored       = actor.AddScript(removed.PrefabObject.GetType());
                var prefabId       = actor.PrefabID;
                var prefabObjectId = restored.PrefabObjectID;
                Script.Internal_LinkPrefab(restored.unmanagedPtr, ref prefabId, ref prefabObjectId);
                string data = JsonSerializer.Serialize(removed.PrefabObject);
                JsonSerializer.Deserialize(restored, data);

                var action = AddRemoveScript.Added(restored);
                Presenter.Undo?.AddAction(action);

                return;
            }

            // Special case for new Script added to actor
            if (editor.Values[0] is Script script && !script.HasPrefabLink)
            {
                Editor.Log("Reverting added script changes to prefab (removing it)");

                var action = AddRemoveScript.Remove(script);
                action.Do();
                Presenter.Undo?.AddAction(action);

                return;
            }

            editor.RevertToReferenceValue();
        }
예제 #2
0
        protected virtual void DrawChildFields()
        {
            List <FieldInfo> childFields = new List <FieldInfo>();
            Type             type        = target.GetType();

            CustomEditor customEditor = GetType().GetCustomAttribute <CustomEditor>();
            FieldInfo    fieldInfo    = typeof(CustomEditor)
                                        .GetField("m_InspectedType",
                                                  BindingFlags.NonPublic
                                                  | BindingFlags.Instance
                                                  | BindingFlags.GetField);
            Type baseType = fieldInfo.GetValue(customEditor) as Type;

            while (type != null && type != baseType)
            {
                childFields.InsertRange(0, type.GetFields(
                                            BindingFlags.DeclaredOnly
                                            | BindingFlags.Instance
                                            | BindingFlags.Public
                                            | BindingFlags.NonPublic));

                type = type.BaseType;
            }

            foreach (FieldInfo field in childFields)
            {
                if (field.IsPublic || field.GetCustomAttribute(typeof(SerializeField)) != null)
                {
                    EditorGUILayout.PropertyField(serializedObject.FindProperty(field.Name));
                }
            }
        }
        private void SetPlaceholder(CustomEditor element)
        {
            Placeholder       = element.Placeholder;
            Control.TextColor = UIColor.LightGray;  // Цвет плейсхолдера
            Control.Text      = Placeholder;

            Control.ShouldBeginEditing += (UITextView textView) => // Если элемент получил фокус ввода
            {
                if (textView.Text == Placeholder)                  // Если текст в поле ввода = плейсхолдеру
                {
                    textView.Text      = "";                       // Очищаем текст
                    textView.TextColor = UIColor.Black;            // Устанавливаем цвет текста
                }

                return(true);
            };

            Control.ShouldEndEditing += (UITextView textView) => // Если с элемента снят фокус
            {
                if (textView.Text == "")                         // Если поле пусто
                {
                    textView.Text      = Placeholder;            // Выводим плейсхолдер
                    textView.TextColor = UIColor.LightGray;      // Устанавливаем цвет плейсхолдера
                }

                return(true);
            };
        }
예제 #4
0
        public static Type GetCustomEditorAttrType(CustomEditor data)
        {
            FieldInfo ceInfo   = typeof(CustomEditor).GetField("m_InspectedType", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
            Type      destType = ceInfo.GetValue(data) as Type;

            return(destType);
        }
예제 #5
0
        private void AddTextBlock(object sender, EventArgs args)
        {
            var addtext = new CustomEditor();

            addtext.CornerRadii     = new int[] { 30, 30, 30, 30 };
            addtext.BackGroundColor = Color.Gray;
            addtext.EndColor        = Color.White;
            addtext.HeightRequest   = 250;
            addtext.Unfocused      += (s, e) =>
            {
                var LabelText = (s as Editor).Text;
                MainContent.Children.Remove(s as Editor);
                if (!string.IsNullOrEmpty(LabelText))
                {
                    MainContent.Children.Add(new Label()
                    {
                        FormattedText = (new GroupDescriptionConverter()).Convert(LabelText, typeof(FormattedString)) as FormattedString,
                        TextColor     = Color.Black,
                        FontSize      = 20
                    });
                }
            };
            addtext.TextChanged += Addtext_TextChanged;
            MainContent.Children.Add(addtext);
            Device.BeginInvokeOnMainThread(() => addtext.Focus());
        }
예제 #6
0
        public CustomEditorViewModel()
        {
            PrivateEmployee            = new PrivateEmployee();
            PrivateEmployee.Name       = "Johnson";
            PrivateEmployee.Age        = 25;
            PrivateEmployee.EmailID    = "johnabc@gt";
            PrivateEmployee.Experience = 5;
            PrivateEmployee.Height     = 260;
            PrivateEmployee.Image      = new BitmapImage(new Uri("/syncfusion.demoscommon.wpf;component/Assets/People/People_Circle31.png", UriKind.RelativeOrAbsolute));
            PrivateEmployee.Salary     = "500";
            PrivateEmployee.Weight     = 100;

            //Initialize the custom editor collection
            CustomEditorCollection = new CustomEditorCollection();

            // CurrenyEditor added to the collection and will applied to the "Salary" property
            CustomEditor customEditor = new CustomEditor();

            customEditor.Editor = new CurrencyEditor();
            customEditor.Properties.Add("Salary");

            CustomEditorCollection.Add(customEditor);

            //DoubleUpdownEditor added to the collection and it will applied to the "Double" type properties
            CustomEditor customEditor1 = new CustomEditor();

            customEditor1.Editor          = new DoubleUpDownEditor();
            customEditor1.HasPropertyType = true;
            customEditor1.PropertyType    = typeof(double);

            CustomEditorCollection.Add(customEditor1);
        }
예제 #7
0
 internal void LinkEditor(CustomEditor editor)
 {
     if (LinkedEditor == null)
     {
         LinkedEditor = editor;
         editor.LinkLabel(this);
     }
 }
예제 #8
0
    static void OpenWindow()
    {
        CustomEditor window = (CustomEditor)GetWindow(typeof(CustomEditor));

        window.minSize = new UnityEngine.Vector2(900, 600);
        window.maxSize = new UnityEngine.Vector2(900, 600);
        window.Show();
    }
        /// <inheritdoc />
        protected override void OnAddEditor(CustomEditor editor)
        {
            // Link to the last label
            if (Labels.Count > 0)
            {
                Labels[Labels.Count - 1].LinkEditor(editor);
            }

            base.OnAddEditor(editor);
        }
예제 #10
0
        /// <inheritdoc />
        protected override bool OnDirty(CustomEditor editor, object value, object token = null)
        {
            // Check if Atlas has been changed
            if (editor is AssetRefEditor)
            {
                // Rebuild layout to update the dropdown menu with sprites list
                RebuildLayoutOnRefresh();
            }

            return(base.OnDirty(editor, value, token));
        }
예제 #11
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        if (GUILayout.Button("Log Player's Health"))
        {
            //Casting Reference of this script to our class type
            CustomEditor tempScript = (CustomEditor)target;

            tempScript.LogPlayerHealth();
        }
    }
예제 #12
0
        void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            HideProperties(typeof(TextBlock));
            CustomEditor doubleeditor = new CustomEditor()
            {
                Editor = new DoubleEditor()
            };

            doubleeditor.Properties.Add("FontSize");
            pgrid.CustomEditorCollection.Add(doubleeditor);
            pgrid.RefreshPropertygrid();
        }
예제 #13
0
        protected override void OnElementChanged(ElementChangedEventArgs <Editor> e)
        {
            base.OnElementChanged(e);
            element = (CustomEditor)this.Element;
            var editerText = this.Control;

            Control.TextAlignment = Android.Views.TextAlignment.TextStart;
            // Control.Background = Android.App.Application.Context.GetDrawable(Resource.Drawable.roundedSearchButton);
            Control.Gravity = GravityFlags.Start;
            Control.SetPadding(10, 10, 10, 10);
            Control.Background.SetColorFilter(element.BackgroundColor.ToAndroid(), PorterDuff.Mode.SrcAtop);
        }
예제 #14
0
        public void WindowLoaded(object param)
        {
            propertyGrid = param as PropertyGrid;
            HideProperties(typeof(TextBlock));
            CustomEditor doubleeditor = new CustomEditor()
            {
                Editor = new DoubleEditor()
            };

            doubleeditor.Properties.Add("FontSize");
            propertyGrid.CustomEditorCollection.Add(doubleeditor);
            propertyGrid.RefreshPropertygrid();
        }
예제 #15
0
 public override NSTextView FieldEditorForView(NSView aControlView)
 {
     if (editor == null)
     {
         editor = new CustomEditor {
             Context     = this.Context,
             EventSink   = this.EventSink,
             FieldEditor = true,
             Editable    = true,
         };
         selChangeObserver = NSNotificationCenter.DefaultCenter.AddObserver(new NSString("NSTextViewDidChangeSelectionNotification"), HandleSelectionDidChange, editor);
     }
     return(editor);
 }
예제 #16
0
        public ViewModel()
        {
            SelectedEmployee = new Employee()
            {
                Age = 25, Name = "mark", Experience = 5, EmailID = "mark@gt"
            };
            // IntegerEditor added to the CustomEditorCollection and will applied to the "int" type properties
            CustomEditor editor = new CustomEditor();

            editor.Editor          = new IntegerEditor();
            editor.HasPropertyType = true;
            editor.PropertyType    = typeof(int);
            CustomEditorCollection.Add(editor);
        }
예제 #17
0
        public override void Draw(Canvas canvas)
        {
            CustomEditor customEditor = (CustomEditor)this.Element;

            // Create path to clip
            var path = new Path();

            path.AddRoundRect(0, 0, Width, Height, DpToPixels(this.Context, Convert.ToSingle(customEditor.CornerRadius)),
                              DpToPixels(this.Context, Convert.ToSingle(customEditor.CornerRadius)), Path.Direction.Ccw);

            canvas.Save();
            canvas.ClipPath(path);

            base.Draw(canvas);
        }
 public override NSTextView FieldEditorForView(NSView aControlView)
 {
     if (editor == null)
     {
         editor = new CustomEditor {
             Context         = this.Context,
             EventSink       = this.EventSink,
             FieldEditor     = true,
             Editable        = true,
             DrawsBackground = true,
             BackgroundColor = NSColor.White,
         };
     }
     return(editor);
 }
예제 #19
0
 public static void Init()
 {
     Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
     foreach (Assembly ass in assemblies)
     {
         Type[] types = ass.GetTypes();
         foreach (Type type in types)
         {
             CustomEditor ce = type.GetCustomAttribute <CustomEditor>();
             if (ce != null)
             {
                 Type destType = GetCustomEditorAttrType(ce);
                 _t2t[destType] = type;
             }
         }
     }
 }
        void SetDoneButton(CustomEditor view)
        {
            var doneButton = new UIBarButtonItem(UIBarButtonSystemItem.Done, (o, a) =>
            {
                App.IsFromKeyboardDoneButton = true;
                Control.ResignFirstResponder();
            });

            var toolbar = new UIToolbar(new RectangleF(0.0f, 0.0f, (float)Control.Frame.Size.Width, 44.0f));

            toolbar.Items = new[]
            {
                new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                doneButton
            };
            this.Control.InputAccessoryView = toolbar;
        }
예제 #21
0
        public void InitilizeSettings(object param)
        {
            var pgrid = param as PropertyGrid;

            pgrid.DefaultPropertyPath = "SmallIcon";
            CustomEditor upDownEditor = new CustomEditor()
            {
                HasPropertyType = true, PropertyType = typeof(double), Editor = new UpDownEditor()
            };
            CustomEditor imgeditor = new CustomEditor()
            {
                HasPropertyType = true, PropertyType = typeof(ImageSource), Editor = new ImageEditor()
            };

            pgrid.CustomEditorCollection.Add(upDownEditor);
            pgrid.CustomEditorCollection.Add(imgeditor);
            HideProperties(pgrid, typeof(ButtonAdv));
        }
예제 #22
0
        private void MainWindow_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Control)
            {
                var kp = e.KeyCode;
                switch (kp)
                {
                case Keys.S:
                    dashboard.saveDocument();
                    break;

                case Keys.B:
                    CustomEditor.makeBold(dashboard.richTextBox1);
                    break;

                case Keys.I:
                    CustomEditor.makeItalic(dashboard.richTextBox1);
                    break;

                case Keys.U:
                    CustomEditor.makeUnderline(dashboard.richTextBox1);
                    break;

                case Keys.Oemplus:
                    CustomEditor.zoomIn(dashboard.richTextBox1);
                    break;

                case Keys.OemMinus:
                    CustomEditor.zoomOut(dashboard.richTextBox1);
                    break;

                case Keys.D0:
                    dashboard.richTextBox1.ZoomFactor = 1.0f;
                    break;

                case Keys.NumPad0:
                    dashboard.richTextBox1.ZoomFactor = 1.0f;
                    break;

                default:
                    break;
                }
            }
        }
예제 #23
0
        internal static void FindSpyglassEditors()
        {
            m_SpyglassEditors.Clear();

            foreach (Type t in TypeRepository.GetTypes())
            {
                Type         inspectedType = null;
                CustomEditor ce            = t.GetAttribute <CustomEditor>();
                if (ce != null && t.HasInterface <ISpyglassEditor>())
                {
                    inspectedType = ce.GetInspectedType();
                    m_SpyglassEditors.GetOrAdd(inspectedType, key => new List <Type>()).Add(t);
                }
                SpyglassAttribute sa = t.GetAttribute <SpyglassAttribute>();
                if (sa != null && t.HasInterface <ISpyglassEditor>() && sa.inspectedType != inspectedType)
                {
                    m_SpyglassEditors.GetOrAdd(sa.inspectedType, key => new List <Type>()).Add(t);
                }
            }
        }
예제 #24
0
        private void RetrieveObjectClassGroup()
        {
            IEnumerable <Type> collection = Utils.FindSubClassesOf <EasyEditorBase>();

            foreach (Type editorScript in collection)
            {
                CustomEditor customEditorAttribute = AttributeHelper.GetAttribute <CustomEditor>(editorScript);
                if (customEditorAttribute != null)
                {
                    Type inspectedType = typeof(CustomEditor).
                                         GetField("m_InspectedType", BindingFlags.NonPublic | BindingFlags.Instance).
                                         GetValue(customEditorAttribute) as Type;

                    bool editorForChildClasses = (bool)typeof(CustomEditor).
                                                 GetField("m_EditorForChildClasses", BindingFlags.NonPublic | BindingFlags.Instance).
                                                 GetValue(customEditorAttribute);

                    if (GetClassType() == inspectedType ||
                        (inspectedType.IsAssignableFrom(GetClassType()) &&
                         editorForChildClasses))
                    {
                        GroupsAttribute groupAttribute = AttributeHelper.GetAttribute <GroupsAttribute>(editorScript);
                        if (groupAttribute != null)
                        {
                            groups = new Groups(groupAttribute.groups);
                        }
                        else
                        {
                            groups = new Groups(new string[] { "" });
                        }

                        break;
                    }
                }
            }

            if (groups == null)
            {
                groups = new Groups(new string[] { "" });
            }
        }
예제 #25
0
 /// <inheritdoc />
 protected override bool OnDirty(CustomEditor editor, object value, object token = null)
 {
     if (NotNullItems)
     {
         if (value == null && editor.ParentEditor == this)
         {
             return(false);
         }
         if (editor == this && value is IList list)
         {
             for (int i = 0; i < list.Count; i++)
             {
                 if (list[i] == null)
                 {
                     return(false);
                 }
             }
         }
     }
     return(base.OnDirty(editor, value, token));
 }
예제 #26
0
        private TreeNode CreateDiffNode(CustomEditor editor)
        {
            var node = new TreeNode(false)
            {
                Tag = editor
            };

            // Removed Script
            if (editor is RemovedScriptDummy removed)
            {
                node.TextColor = Color.OrangeRed;
                node.Text      = CustomEditorsUtil.GetPropertyNameUI(removed.PrefabObject.GetType().Name);
            }
            // Actor or Script
            else if (editor.Values[0] is ISceneObject sceneObject)
            {
                node.TextColor = sceneObject.HasPrefabLink ? FlaxEngine.GUI.Style.Current.ProgressNormal : FlaxEngine.GUI.Style.Current.BackgroundSelected;
                node.Text      = CustomEditorsUtil.GetPropertyNameUI(sceneObject.GetType().Name);
            }
            // Array Item
            else if (editor.ParentEditor?.Values?.Type.IsArray ?? false)
            {
                node.Text = "Element " + editor.ParentEditor.ChildrenEditors.IndexOf(editor);
            }
            // Common type
            else if (editor.Values.Info != ScriptMemberInfo.Null)
            {
                node.Text = CustomEditorsUtil.GetPropertyNameUI(editor.Values.Info.Name);
            }
            // Custom type
            else if (editor.Values[0] != null)
            {
                node.Text = editor.Values[0].ToString();
            }

            node.Expand(true);

            return(node);
        }
        public MainWindow()
        {
            InitializeComponent();

            string candidateName = "John";
            int    age           = 25;

            _CanididateDetails.Values.Add("Name", candidateName);
            _CanididateDetails.Values.Add("Address", new List <string>()
            {
                "A", "B", "C"
            });
            _CanididateDetails.Values.Add("Age", age);
            this.propertyGrid.SelectedObject = _CanididateDetails;
            CustomEditor comboeditor = new CustomEditor()
            {
                HasPropertyType = true, PropertyType = typeof(List <string>), Editor = new ComboEditor()
            };

            comboeditor.Properties.Add("Address");
            propertyGrid.CustomEditorCollection.Add(comboeditor);
            propertyGrid.RefreshPropertygrid();
        }
예제 #28
0
        void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            HideProperties(typeof(ButtonAdv));
            pgrid.DefaultPropertyPath = "SmallIcon";
            CustomEditor upDownEditor = new CustomEditor()
            {
                HasPropertyType = true, PropertyType = typeof(double), Editor = new UpDownEditor()
            };
            CustomEditor brusheditor = new CustomEditor()
            {
                HasPropertyType = true, PropertyType = typeof(Brush), Editor = new BrushEditor()
            };

            pgrid.CustomEditorCollection.Add(brusheditor);
            CustomEditor imgeditor = new CustomEditor()
            {
                HasPropertyType = true, PropertyType = typeof(ImageSource), Editor = new ImageEditor()
            };

            pgrid.CustomEditorCollection.Add(upDownEditor);
            pgrid.CustomEditorCollection.Add(imgeditor);
            pgrid.RefreshPropertygrid();
        }
예제 #29
0
    public CustomEditorViewModel()
    {
        //Initialize the custom editor collection
        CustomEditorCollection = new CustomEditorCollection();

        // CurrenyEditor added to CustomEditor collection
        // And it will applied to the "Salary" property
        CustomEditor customEditor = new CustomEditor();

        customEditor.Editor = new CurrencyEditor();
        customEditor.Properties.Add("Salary");

        CustomEditorCollection.Add(customEditor);

        //DoubleUpdownEditor added to the collection
        //And it will applied to the "Double" type properties
        CustomEditor customEditor1 = new CustomEditor();

        customEditor1.Editor          = new DoubleUpDownEditor();
        customEditor1.HasPropertyType = true;
        customEditor1.PropertyType    = typeof(double);

        CustomEditorCollection.Add(customEditor1);
    }
예제 #30
0
        public void FillComletionList(List <CompletionItem> completitionItemList)
        {
            Dictionary <string, List <string> > completitionDictionary = new Dictionary <string, List <string> >();
            List <string> duplicates = new List <string>();

            foreach (CompletionItem item in completitionItemList)
            {
                List <string> attributes = new List <string>();
                attributes.Add(item.PopUpText);
                attributes.Add(item.ReplacementText);

                if (item.DisplayText != null && !completitionDictionary.ContainsKey(item.DisplayText))
                {
                    completitionDictionary.Add(item.DisplayText, attributes);
                }
                else
                {
                    duplicates.Add(item.DisplayText);
                }
            }
            int a = 0;

            CustomEditor.FillCompletionData(completitionDictionary);
        }
        public AddEventsSituationsOrThoughts(string title, DetailsPageModel detailsPageModel = null)
        {
            NavigationPage.SetHasNavigationBar(this, false);
            masterLayout = new CustomLayout();
            audioRecorder = DependencyService.Get<PurposeColor.interfaces.IAudioRecorder>();
            //deviceSpec = DependencyService.Get<IDeviceSpec>();
            screenHeight = App.screenHeight;
            screenWidth = App.screenWidth;

            masterLayout.BackgroundColor = Constants.PAGE_BG_COLOR_LIGHT_GRAY;
            pageTitle = title;
            lattitude = string.Empty;
            longitude = string.Empty;
            currentAddress = string.Empty;
            int devWidth = (int)screenWidth;
            App.MediaArray = new List<MediaItem>();
            App.ContactsArray = new List<string>();
            App.PreviewListSource.Clear();
            int textInputWidth = (int)(devWidth * .80);
			contactSelectAction = OnContactSelected;

            #region TITLE BARS
            TopTitleBar = new StackLayout
            {
                BackgroundColor = Constants.BLUE_BG_COLOR,
                HorizontalOptions = LayoutOptions.StartAndExpand,
                VerticalOptions = LayoutOptions.StartAndExpand,
                Padding = 0,
                Spacing = 0,
                Children = { new BoxView { WidthRequest = screenWidth } }
            };
            masterLayout.AddChildToLayout(TopTitleBar, 0, 0);
            
            string trimmedPageTitle = string.Empty;

            int titleMaxLength = 24;
            if (App.screenDensity > 1.5)
            {
                titleMaxLength = 24;
            }
            else
            {
                titleMaxLength = 22;
            }

            if (title.Length > titleMaxLength)
            {
                trimmedPageTitle = title.Substring(0, titleMaxLength);
                trimmedPageTitle += "..";
            }
            else
            {
                trimmedPageTitle = pageTitle;
            }

            subTitleBar = new PurposeColorBlueSubTitleBar(Constants.SUB_TITLE_BG_COLOR, trimmedPageTitle, true, true);
            masterLayout.AddChildToLayout(subTitleBar, 0, 1);
            subTitleBar.BackButtonTapRecognizer.Tapped += OnBackButtonTapRecognizerTapped;
            subTitleBar.NextButtonTapRecognizer.Tapped += NextButtonTapRecognizer_Tapped;
            #endregion

            #region EVENT TITLE - CUSTOM ENTRY

            eventTitle = new CustomEntry
            {
                VerticalOptions = LayoutOptions.StartAndExpand,
                HorizontalOptions = LayoutOptions.StartAndExpand,
                BackgroundColor = Color.White,
                Placeholder = "Title",
                TextColor = Color.FromHex("#424646"),
                HeightRequest = Device.OnPlatform(50,50,73),
                WidthRequest = (int)(devWidth * .90) // 90% of screen,
            };
			eventTitle.TextChanged += EventTitle_TextChanged;

            
            //if (App.screenDensity > 1.5)
            //{
            //    eventTitle.HeightRequest = screenHeight * 6 / 100;
            //}
            //else
            //{
            //    eventTitle.HeightRequest = screenHeight * 9 / 100;
            //}
            masterLayout.AddChildToLayout(eventTitle, 5, 11);

            #endregion

            #region EVENT DESCRIPTION

            eventDescription = new CustomEditor
            {
                VerticalOptions = LayoutOptions.StartAndExpand,
                HorizontalOptions = LayoutOptions.StartAndExpand,
                HeightRequest = 100,
                Placeholder = pageTitle,
                BackgroundColor = Color.White
            };
			eventDescription.TextChanged += EventDescription_TextChanged;
				

            eventDescription.WidthRequest = textInputWidth;

            if (detailsPageModel != null)
            {
				if (detailsPageModel.IsCopyingGem) {
					isUpdatePage = false;
				}
				else
				{
					isUpdatePage = true;
				}

                currentGemId = detailsPageModel.gemId;
                if (detailsPageModel.gemType != null)
                {
                    currentGemType = detailsPageModel.gemType;
                    switch (currentGemType)
                    {
                        case GemType.Goal:
                            pageTitle = Constants.EDIT_GOALS;
                            break;
                        case GemType.Event:
                            pageTitle = Constants.EDIT_EVENTS;
                            break;
                        case GemType.Action:
                            pageTitle = Constants.EDIT_ACTIONS;
                            break;
                        default:
                            break;
                    }
                }
                
                if (detailsPageModel.titleVal != null)
                {
                    eventTitle.Text = detailsPageModel.titleVal;
                }
                if ( detailsPageModel.description != null)
	            {
		             eventDescription.Text = detailsPageModel.description;
	            }
            }

            #endregion

            #region MEDIA INPUTS

            Image pinButton = new Image
            {
                BackgroundColor = Color.Transparent,
                VerticalOptions = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Center,
                Source = Device.OnPlatform("icn_attach.png", "icn_attach.png", "//Assets//icn_attach.png"),

            };
            StackLayout pinButtonHolder = new StackLayout
            {
                Padding = 10,
                VerticalOptions = LayoutOptions.Start,
                Children = { pinButton }
            };
            TapGestureRecognizer pinButtonTapRecognizer = new TapGestureRecognizer();
            pinButtonHolder.GestureRecognizers.Add(pinButtonTapRecognizer);
            pinButtonTapRecognizer.Tapped += (s, e) =>
            {
                iconContainerGrid.IsVisible = !iconContainerGrid.IsVisible;
            };

            Image audioRecodeOnButton = new Image
            {
                BackgroundColor = Color.Transparent,
                VerticalOptions = LayoutOptions.Center,
                Source = Device.OnPlatform("mic.png", "mic.png", "//Assets//mic.png"),
            };
            audioRecodeOnHolder = new StackLayout
            {
                Padding = 10,
                VerticalOptions = LayoutOptions.End,
                Children = { audioRecodeOnButton }
            };
            TapGestureRecognizer RecodeOnTapRecognizer = new TapGestureRecognizer();
            audioRecodeOnHolder.GestureRecognizers.Add(RecodeOnTapRecognizer);

            audioRecodeOffButton = new Image
            {
                BackgroundColor = Color.Transparent,
                VerticalOptions = LayoutOptions.Center,
                Source = Device.OnPlatform("turn_off_mic.png", "turn_off_mic.png", "//Assets//turn_off_mic.png"),
            };
            audioRecodeOffHolder = new StackLayout
            {
                BackgroundColor = Color.Transparent,
                Padding = 10,
                VerticalOptions = LayoutOptions.End,
                IsVisible = false,
                Children = { audioRecodeOffButton }
            };
            TapGestureRecognizer RecodeOffTapRecognizer = new TapGestureRecognizer();
            audioRecodeOffHolder.GestureRecognizers.Add(RecodeOffTapRecognizer);

            audioRecodeOffHolder.TranslateTo(0, Device.OnPlatform(audioRecodeOffButton.Y + 60, audioRecodeOffButton.Y + 60, audioRecodeOffButton.Y + 50), 5, null);
            audioRecodeOnHolder.TranslateTo(0, Device.OnPlatform(audioRecodeOffButton.Y + 60, audioRecodeOffButton.Y + 60, audioRecodeOffButton.Y + 50), 5, null);

            RecodeOnTapRecognizer.Tapped += RecodeOnTapRecognizer_Tapped;
            RecodeOffTapRecognizer.Tapped += RecodeOffTapRecognizer_Tapped;

            StackLayout menuPinContainer = new StackLayout
            {
                BackgroundColor = Color.White,
                Orientation = StackOrientation.Vertical,
                HeightRequest = 140,
                WidthRequest = (int)(devWidth * .10),
                Children = {
                    pinButtonHolder, 
                    audioRecodeOnHolder, 
                    audioRecodeOffHolder
                }
            };


            TapGestureRecognizer locationlabelTap = new TapGestureRecognizer();

            locationInfo = new Label();
            locationInfo.TextColor = Constants.BLUE_BG_COLOR;
            locationInfo.BackgroundColor = Color.Transparent;
            locationInfo.FontSize = 12;
            locationInfo.HeightRequest = Device.OnPlatform(15, 25, 25);
            locationInfo.GestureRecognizers.Add(locationlabelTap);
            locationlabelTap.Tapped += OnEditLocationInfo;

            editLocationAndContactsStack = new StackLayout();
            editLocationAndContactsStack.Padding = new Thickness(1, 1, 1, 1);
            editLocationAndContactsStack.BackgroundColor = Color.FromRgb(30, 126, 210);
            editLocationAndContactsStack.WidthRequest = App.screenWidth * 90 / 100;
            editLocationAndContactsStack.IsVisible = false;
            editLocationAndContactsStack.Orientation = StackOrientation.Horizontal;


            locAndContactsEntry = new Entry();
            locAndContactsEntry.TextColor = Color.Black;
            locAndContactsEntry.BackgroundColor = Color.White;
            locAndContactsEntry.VerticalOptions = LayoutOptions.Center;
            locAndContactsEntry.WidthRequest = App.screenWidth * 80 / 100;
            locAndContactsEntry.HeightRequest = 50;

            editLocationDoneButton = new CustomImageButton();
            editLocationDoneButton.VerticalOptions = LayoutOptions.Center;
            editLocationDoneButton.ImageName = "icn_done.png";
            editLocationDoneButton.HeightRequest = 25;
            editLocationDoneButton.WidthRequest = 25;
            editLocationDoneButton.Clicked += OnLocationEditCompleted;


            editLocationAndContactsStack.Children.Add(locAndContactsEntry);
            editLocationAndContactsStack.Children.Add(editLocationDoneButton);

            if (Device.OS == TargetPlatform.iOS)
            {
                editLocationAndContactsStack.TranslationY = -30;
            }

            locLayout = new StackLayout();
            locLayout.Orientation = StackOrientation.Vertical;
            locLayout.BackgroundColor = Color.Transparent;



            locLayout.Children.Add(locationInfo);

            TapGestureRecognizer contactsLabelTap = new TapGestureRecognizer();
            contactInfo = new Label();
            contactInfo.TextColor = Constants.BLUE_BG_COLOR;
            contactInfo.BackgroundColor = Color.Transparent;
            contactInfo.FontSize = 12;
            contactInfo.HeightRequest = Device.OnPlatform(15, 25, 25);
            contactInfo.GestureRecognizers.Add(contactsLabelTap);
            contactsLabelTap.Tapped += async (object sender, EventArgs e) =>
            {
                editLocationAndContactsStack.ClassId = "contactedit";
                string spanContacts = "";
                if (contactInfo.FormattedText != null && contactInfo.FormattedText.Spans.Count > 1)
                    spanContacts = contactInfo.FormattedText.Spans[1].Text;
                locAndContactsEntry.Text = spanContacts;
                editLocationAndContactsStack.IsVisible = true;
                contactInfo.IsVisible = false;
                iconContainerGrid.IsVisible = false;
                locationInfo.IsVisible = true;

                await editLocationAndContactsStack.TranslateTo(100, 0, 300, Easing.SinInOut);
                await editLocationAndContactsStack.TranslateTo(0, 0, 300, Easing.SinIn);

            };

            locLayout.IsVisible = false;
            contactInfo.IsVisible = false;
            
            #endregion

            if(detailsPageModel != null)
            {
                if (detailsPageModel.eventMediaArray!= null && detailsPageModel.eventMediaArray.Count > 0)
                {
                    foreach (EventMedia eventObj in detailsPageModel.eventMediaArray)
                    {
						if (eventObj.event_media != null && !eventObj.event_media.Contains("default")) {
							AddFilenameToMediaList(eventObj.event_media);
						}
                    }
                }

                if (detailsPageModel.goal_media != null && detailsPageModel.goal_media.Count > 0)
                {
                    foreach (SelectedGoalMedia goalObj in detailsPageModel.goal_media)
                    {
						if (goalObj.goal_media != null && !goalObj.goal_media.Contains("default")) {
							AddFilenameToMediaList(goalObj.goal_media);
						}
                    }
                }

                if (detailsPageModel.actionMediaArray != null && detailsPageModel.actionMediaArray.Count > 0)
                {
                    foreach (ActionMedia actionObj in detailsPageModel.actionMediaArray)
                    {
						if (actionObj.action_media != null && !actionObj.action_media.Contains("default")) {
							AddFilenameToMediaList(actionObj.action_media);
						}
                    }
                }

            }



            StackLayout entryAndLocContainer = new StackLayout();
            entryAndLocContainer.Orientation = StackOrientation.Vertical;
            entryAndLocContainer.BackgroundColor = Color.White;
            entryAndLocContainer.Children.Add( eventDescription );
			entryAndLocContainer.Children.Add(contactInfo);
            entryAndLocContainer.Children.Add(locLayout);

            textInputContainer = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                Spacing = 0,
                Padding = 0,
                Children = { entryAndLocContainer, menuPinContainer }
            };

            #region ICONS

            audioInput = new Image()
            {
                Source = Device.OnPlatform("ic_music.png", "ic_music.png", "//Assets//ic_music.png"),
                Aspect = Aspect.AspectFit
            };

            int ICON_SIZE = 8;

            if( Device.OS == TargetPlatform.WinPhone )
            {
                audioInput.WidthRequest = screenWidth * ICON_SIZE / 100;
                audioInput.HeightRequest = screenWidth * ICON_SIZE / 100;
            }
            audioInputStack = new StackLayout
            {
                Padding = new Thickness(5, 10, 5, 10),
                //BackgroundColor = Constants.STACK_BG_COLOR_GRAY,
                //HorizontalOptions = LayoutOptions.Center,
                Spacing = 0,
                Children = { audioInput 
                                /*, new Label { Text = "Audio", TextColor = Constants.TEXT_COLOR_GRAY, FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)) }*/ 
                           }
            };

            cameraInput = new Image()
            {
                Source = Device.OnPlatform("icn_camera.png", "icn_camera.png", "//Assets//icn_camera.png"),
                Aspect = Aspect.AspectFit
            };



            if (Device.OS == TargetPlatform.WinPhone)
            {
                cameraInput.WidthRequest = screenWidth * ICON_SIZE / 100;
                cameraInput.HeightRequest = screenWidth * ICON_SIZE / 100;
            }


            cameraInputStack = new StackLayout
            {
                Padding = new Thickness(5, 10, 5, 10),
                //BackgroundColor = Constants.STACK_BG_COLOR_GRAY,
                //HorizontalOptions = LayoutOptions.Center,
                Spacing = 0,
                Children = { cameraInput
                                /*, new Label { Text = "Camera", TextColor = Constants.TEXT_COLOR_GRAY, FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)) } 
                                 */
                            }
            };
            cameraInputStack.ClassId = "camera";

            #region CAMERA TAP RECOGNIZER
            CameraTapRecognizer = new TapGestureRecognizer();
            cameraInputStack.GestureRecognizers.Add(CameraTapRecognizer);
            CameraTapRecognizer.Tapped += async (s, e) =>
            {
                try
                {
					await ApplyAnimation( cameraInputStack );
                    StackLayout send = s as StackLayout;
                    MediaSourceChooser chooser = new MediaSourceChooser(this, masterLayout, send.ClassId);
                    chooser.ClassId = "mediachooser";
                    masterLayout.AddChildToLayout(chooser, 0, 0);
                   
                }
                catch (System.Exception ex)
                {
                    DisplayAlert("Camera", ex.Message + " Please try again later", "ok");
                }

                /*
                try
                {
                    StackLayout send = s as StackLayout;
                    MediaSourceChooser chooser = new MediaSourceChooser(this, masterLayout, send.ClassId);
                    chooser.ClassId = "mediachooser";
                    masterLayout.AddChildToLayout(chooser, 0, 0);
                }
                catch (System.Exception ex)
                {
                    DisplayAlert("Camera", ex.Message + " Please try again later", "ok");
                }
                */
            };

            #endregion

            galleryInput = new Image()
            {
                Source = Device.OnPlatform("icn_gallery.png", "icn_gallery.png", "//Assets//icn_gallery.png"),
                Aspect = Aspect.AspectFit
            };

            if (Device.OS == TargetPlatform.WinPhone)
            {
                galleryInput.WidthRequest = screenWidth * ICON_SIZE / 100;
                galleryInput.HeightRequest = screenWidth * ICON_SIZE / 100;
            }

            galleryInputStack = new StackLayout
            {
                Padding = new Thickness(5, 10, 5, 10),
                Spacing = 0,
                Children = { galleryInput 
                                //new Label { Text = "Gallery", TextColor = Constants.TEXT_COLOR_GRAY, FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)) } 
                            }
            };
            galleryInputStack.ClassId = "gallery";

            #region GALLERY  TAP RECOGNIZER

            TapGestureRecognizer galleryInputStackTapRecognizer = new TapGestureRecognizer();
            galleryInputStack.GestureRecognizers.Add(galleryInputStackTapRecognizer);
            galleryInputStackTapRecognizer.Tapped += async (s, e) =>
            {
				await ApplyAnimation( galleryInputStack );
                StackLayout send = s as StackLayout;
                MediaSourceChooser chooser = new MediaSourceChooser(this, masterLayout, send.ClassId);
                chooser.ClassId = "mediachooser";
                masterLayout.AddChildToLayout(chooser, 0, 0);

            };

            #endregion

            locationInput = new Image()
            {
                Source = Device.OnPlatform("icn_location.png", "icn_location.png", "//Assets//icn_location.png"),
                Aspect = Aspect.AspectFit
            };

            if (Device.OS == TargetPlatform.WinPhone)
            {
                locationInput.WidthRequest = screenWidth * ICON_SIZE / 100;
                locationInput.HeightRequest = screenWidth * ICON_SIZE / 100;
            }


            locationInputStack = new StackLayout
            {
                Padding = new Thickness(5, 10, 5, 10),
                //BackgroundColor = Constants.STACK_BG_COLOR_GRAY,
                //HorizontalOptions = LayoutOptions.Center,
                Spacing = 0,
                Children = { locationInput
                                //, new Label { Text = "Location", TextColor = Constants.TEXT_COLOR_GRAY, FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)) } 
                            }
            };

            #region LOCATION TAP RECOGNIZER

            TapGestureRecognizer locationInputTapRecognizer = new TapGestureRecognizer();
            locationInputStack.GestureRecognizers.Add(locationInputTapRecognizer);
            locationInputTapRecognizer.Tapped += LocationInputTapRecognizer_Tapped;

            #endregion

            contactInput = new Image()
            {
                Source = Device.OnPlatform("icn_contact.png", "icn_contact.png", "//Assets//icn_contact.png"),
                Aspect = Aspect.AspectFit
            };

            if (Device.OS == TargetPlatform.WinPhone)
            {
                contactInput.WidthRequest = screenWidth * ICON_SIZE / 100;
                contactInput.HeightRequest = screenWidth * ICON_SIZE / 100;
            }

            contactInputStack = new StackLayout
            {
                Padding = new Thickness(5, 10, 0, 10),
                Spacing = 0,
                Children = { contactInput
                    //new Label { Text = "Contact", TextColor = Constants.TEXT_COLOR_GRAY, FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)) }
                     }
            };

            #region CONTACTS TAP RECOGNIZER

            TapGestureRecognizer contactsInputTapRecognizer = new TapGestureRecognizer();
            contactInputStack.GestureRecognizers.Add(contactsInputTapRecognizer);

            contactsInputTapRecognizer.Tapped += async (s, e) =>
            {
				await ApplyAnimation( contactInputStack );

				try
				{
					if( Device.OS == TargetPlatform.Android  || Device.OS == TargetPlatform.iOS )
					{
						IContactPicker testicker = DependencyService.Get< IContactPicker >();
						testicker.ShowContactPicker();
					}	
				}
				catch (Exception ex)
                {
                    DisplayAlert("contactsInputTapRecognizer: ", ex.Message, "ok");
                }
                 
            };

            #endregion

            #endregion

            #region ICON CONTAINER GRID

            iconContainerGrid = new Grid
            {
                IsVisible = false,
                VerticalOptions = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                RowDefinitions = 
            {
                    new RowDefinition { Height = GridLength.Auto }
                },
                ColumnDefinitions = 
            {
                    new ColumnDefinition { Width = new GridLength(((screenWidth * .80) )/4, GridUnitType.Absolute) }, // icon container x = 3 //new ColumnDefinition { Width = GridLength.Auto },
                  //  new ColumnDefinition { Width = new GridLength(((screenWidth * .80)) /5, GridUnitType.Absolute) },
                    new ColumnDefinition { Width = new GridLength(((screenWidth * .80))/4, GridUnitType.Absolute) },
                    new ColumnDefinition { Width = new GridLength(((screenWidth * .80))/4, GridUnitType.Absolute) },
                    new ColumnDefinition { Width = new GridLength(((screenWidth * .80))/4, GridUnitType.Absolute) },
            }
            };

            iconContainerGrid.Children.Add(galleryInputStack, 0, 0);
            iconContainerGrid.Children.Add(cameraInputStack, 1, 0);
          //  iconContainerGrid.Children.Add(audioInputStack, 2, 0);
            iconContainerGrid.Children.Add(locationInputStack, 2, 0);
            iconContainerGrid.Children.Add(contactInputStack, 3, 0);

            textinputAndIconsHolder = new StackLayout
            {
                Orientation = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.Center,
                Spacing = 0,
                Padding = 0,
				Children = { textInputContainer, iconContainerGrid, editLocationAndContactsStack }
            };

            Button createEvent = new Button();
            if (pageTitle == Constants.ADD_ACTIONS || pageTitle == Constants.ADD_GOALS || pageTitle == Constants.EDIT_ACTIONS || pageTitle == Constants.EDIT_GOALS)
            {
                createEvent.BackgroundColor = Color.Transparent;
                createEvent.TextColor = Constants.BLUE_BG_COLOR;
                createEvent.Text = "Create Reminder";
                createEvent.FontSize = 12;
                createEvent.BorderWidth = 0;
                createEvent.BorderColor = Color.Transparent;
                createEvent.Clicked += createEvent_Clicked;
				if( Device.OS == TargetPlatform.iOS )
				createEvent.TranslationY = -8;
                textinputAndIconsHolder.Children.Add(createEvent);

            }
            masterLayout.AddChildToLayout(textinputAndIconsHolder, 5, 21);


            #region PREVIEW LIST
            listContainer = new StackLayout();
            listContainer.BackgroundColor = Constants.PAGE_BG_COLOR_LIGHT_GRAY;
            listContainer.WidthRequest = screenWidth * 90 / 100;
            listContainer.HeightRequest = screenHeight * 25 / 100;
            listContainer.ClassId = "preview";

            previewListView = new ListView();
            previewListView.BackgroundColor = Constants.PAGE_BG_COLOR_LIGHT_GRAY;
            PreviewListViewCellItem.addEvntObject = this;
            previewListView.ItemTemplate = new DataTemplate(typeof(PreviewListViewCellItem));
            previewListView.SeparatorVisibility = SeparatorVisibility.None;
            previewListView.Opacity = 1;
            previewListView.ItemsSource = App.PreviewListSource;
			previewListView.ItemSelected += (object sender, SelectedItemChangedEventArgs e) => 
			{
              /*  PreviewItem items = previewListView.SelectedItem as PreviewItem;
                if( items != null )
                App.Navigator.PushModalAsync( new VideoPlayerView( items.Path ) );*/
				previewListView.SelectedItem = null;
			};
            listContainer.Children.Add(previewListView);
            masterLayout.AddChildToLayout(listContainer, 5, Device.OnPlatform( 63, 63, 50 ));
            #endregion

			//masterLayout.AddChildToLayout(locationEditStack, 5, 30 );
            #endregion

            Content = masterLayout;
        }
        public void Dispose()
        {
            subTitleBar.BackButtonTapRecognizer.Tapped -= OnBackButtonTapRecognizerTapped;
            subTitleBar.NextButtonTapRecognizer.Tapped -= NextButtonTapRecognizer_Tapped;
            masterLayout = null;
            this.TopTitleBar = null;
            this.subTitleBar = null;
            eventDescription = null;
            this.textInputContainer = null;
            this.audioInputStack = null;
            this.cameraInput = null;
            this.audioInput = null;
            this.cameraInputStack = null;
            this.galleryInput = null;
            this.galleryInputStack = null;
            this.locationInput = null;
            this.locationInputStack = null;
            this.contactInput = null;
            this.contactInputStack = null;
            this.textinputAndIconsHolder = null;
            this.audioRecorder = null;
            eventTitle = null;
            this.iconContainerGrid = null;
			this.locAndContactsEntry = null;
			this.editLocationAndContactsStack = null;
			this.editLocationDoneButton = null;
            GC.Collect();
        }