예제 #1
0
        public App()
        {
            InitializeComponent();
            MeetingDepot.GetInstance().LoadFromSave();
            NavigationPage nav = new NavigationPage(new MeetingLogPage());

            MainPage = nav;
        }
예제 #2
0
        public static MeetingDepot GetInstance()
        {
            if (instance == null)
            {
                instance = new MeetingDepot();
            }

            return(instance);
        }
예제 #3
0
        public void SetupEvents()
        {
            compoments = new List <object>();

            var buttonPop = this.FindByName <Button>("buttonAddNewElement");

            buttonPop.Clicked += (sender, e) =>
            {
                this.PopupAddTemplate(sender, e);
            };

            buttonCompleteMeeting.Clicked += (sender, e) =>
            {
                Meeting meeting = null;

                if (IsNew)
                {
                    meeting     = new Meeting();
                    meeting.UID = Extentions.GetUID();
                }
                else
                {
                    meeting = this.data;
                    meeting.Clear();
                }


                foreach (var comps in compoments)
                {
                    if (comps is Feeling)
                    {
                        meeting.AddFeeling(((Feeling)comps).GetData());
                    }
                    else if (comps is QARec)
                    {
                        meeting.AddQARec(((QARec)comps).GetData());
                    }
                    else if (comps is SimpleMemo)
                    {
                        meeting.AddSimpleMemo(((SimpleMemo)comps).GetData());
                    }
                }
                meeting.Title = this.title.Text;

                if (IsNew)
                {
                    MeetingDepot.GetInstance().AddMeetingData(meeting);
                    // now save the data
                    DependencyService.Get <ISaveLoad>().SaveData(meeting.ToJSON());
                    parentHandle.LoadMeetingLogs();
                    //parentHandle.AddSomething();
                }
                else
                {
                    //MeetingDepot.GetInstance().AddMeetingData(meeting);
                    MeetingDepot.GetInstance().UpdateMeetingData(meeting);
                    // now save the data
                    DependencyService.Get <ISaveLoad>().SaveData(meeting.ToJSON());
                    parentHandle.LoadMeetingLogs();
                    //parentHandle.AddSomething();
                }


                Navigation.PopAsync();
            };
        }
예제 #4
0
        public MLCell()
        {
            //instantiate each of our views
            //var image = new Image();
            var LabelName     = new Label();
            var LabelUID      = new Label();
            var verticaLayout = new StackLayout();
            //var horizontalLayout = new StackLayout() { BackgroundColor = Color.Navy };
            var horizontalLayout = new StackLayout();

            //set bindings
            LabelName.SetBinding(Label.TextProperty, new Binding("Title"));
            LabelUID.SetBinding(Label.TextProperty, new Binding("UID"));
            //image.SetBinding(Image.SourceProperty, new Binding("Image"));

            //Set properties for desired design
            horizontalLayout.Orientation       = StackOrientation.Horizontal;
            horizontalLayout.HorizontalOptions = LayoutOptions.Fill;
            //image.HorizontalOptions = LayoutOptions.End;
            LabelName.FontSize = 20;
            LabelUID.FontSize  = 10;

            //add views to the view hierarchy
            verticaLayout.Children.Add(LabelName);
            verticaLayout.Children.Add(LabelUID);
            horizontalLayout.Children.Add(verticaLayout);
            //horizontalLayout.Children.Add(image);

            // add to parent view
            View = horizontalLayout;


            /// CONTEXT ACTIONS..

            var moreAction = new MenuItem {
                Text = "More"
            };

            moreAction.SetBinding(MenuItem.CommandParameterProperty, new Binding("."));
            moreAction.Clicked += (sender, e) =>
            {
                var mi = ((MenuItem)sender);
                //Debug.WriteLine("More Context Action clicked: " + mi.CommandParameter);
            };

            var deleteAction = new MenuItem {
                Text = "Delete", IsDestructive = true
            };                                                                                     // red background

            deleteAction.SetBinding(MenuItem.CommandParameterProperty, new Binding("."));
            deleteAction.Clicked += (sender, e) =>
            {
                var mi = ((MenuItem)sender);
                Debug.WriteLine("Delete Context Action clicked: " + mi.CommandParameter);
                Meeting data = (Meeting)BindingContext;
                Debug.WriteLine(data.filePathSaved);

                //todo: ask 'are you sure?'

                // now delete
                MeetingDepot.GetInstance().RemoveFile(data.filePathSaved);

                // then, reload data
                MeetingLogPage rootPage = (MeetingLogPage)(Parent.Parent.Parent);
                rootPage.LoadMeetingLogs();
            };

            ContextActions.Add(moreAction);
            ContextActions.Add(deleteAction);
        }
예제 #5
0
 public void LoadMeetingLogs()
 {
     // refresh items
     this.meetingList.ItemsSource = null;
     this.meetingList.ItemsSource = MeetingDepot.GetInstance().GetDataAsObseravable();
 }