Exemplo n.º 1
0
        protected override Result <EComponentResult> OnInitialized()
        {
            ComponentName = "KaNote managment";

            var result = base.OnInitialized();

            // TODO: pending check result correctrly

            try
            {
                using (new WaitCursor())
                {
                    NotesSelectorComponent.Run();
                    FoldersSelectorComponent.Run();
                    FilterParamComponent.Run();
                    NoteEditorComponent.Run();
                    MessagesManagmentComponent.Run();

                    NotifyView.ShowView();
                }
            }
            catch (Exception ex)
            {
                result.AddErrorMessage(ex.Message);
            }

            return(result);
        }
        void Save()

        {
            HttpClient          client          = new HttpClient();
            var                 requestString   = JsonConvert.SerializeObject(item);
            var                 httpContent     = new StringContent(requestString, Encoding.UTF8, "application/json");
            HttpResponseMessage responseMessage = client.PostAsync("http://localhost:5000/strgv1/new", httpContent).Result;

            if (responseMessage.IsSuccessStatusCode)
            {
                Item lastItem = new Item();
                if (items.Count > 0)
                {
                    lastItem = items.Last();
                }
                else
                {
                    lastItem.Id = 0;
                }
                NotifyView notifyView = new NotifyView();
                notifyView.ShowDialog();
                item.Id = lastItem.Id + 1;
                items.Add(new Item(item.Id, item.ItemName, item.Quantity, item.Unit, item.Min));
                addItem.Close();
            }
        }
Exemplo n.º 3
0
        protected override void OnStartup(StartupEventArgs e)
        {
            var window     = new MainWindow();
            var notifyView = new NotifyView();

            var mainNavManager  = new NavigationManager(Dispatcher, window.FrameContent);
            var trayIconManager = new TrayIconManager(new CommandFactory(), notifyView);

            container.Register(Component
                               .For <INavigationManager>()
                               .Instance(mainNavManager));

            container.Register(Component
                               .For <ITrayIconManager>()
                               .Instance(trayIconManager));

            var helpViewModel    = container.Resolve <HelpViewModel>();
            var buffersViewModel = container.Resolve <BuffersViewModel>();
            var windowViewModel  = container.Resolve <MainWindowViewModel>();
            var notifyViewModel  = container.Resolve <NotifyViewModel>();

            window.DataContext     = windowViewModel;
            notifyView.DataContext = notifyViewModel;

            mainNavManager.Register <HelpViewModel, HelpView>(
                helpViewModel, NavigationKeys.HelpView);

            mainNavManager.Register <BuffersViewModel, BuffersView>(
                buffersViewModel, NavigationKeys.BuffersView);

            mainNavManager.Navigate(NavigationKeys.HelpView);
            window.Show();
        }
        void Edit()
        {
            HttpClient          client          = new HttpClient();
            var                 requestString   = JsonConvert.SerializeObject(item);
            var                 httpContent     = new StringContent(requestString, Encoding.UTF8, "application/json");
            HttpResponseMessage responseMessage = client.PutAsync("http://localhost:5000/strgv1/update", httpContent).Result;

            if (responseMessage.IsSuccessStatusCode)
            {
                NotifyView notifyView = new NotifyView();
                notifyView.ShowDialog();
                editItemDialog.Close();
            }
        }
Exemplo n.º 5
0
        void Delete()
        {
            HttpClient client        = new HttpClient();
            var        requestString = JsonConvert.SerializeObject(_SelectedItem);
            var        request       = new HttpRequestMessage(HttpMethod.Delete, "http://localhost:5000/strgv1/delete");

            request.Content = new StringContent(requestString, Encoding.UTF8, "application/json");
            HttpResponseMessage responseMessage = client.SendAsync(request).Result;

            Console.WriteLine(requestString);
            if (responseMessage.IsSuccessStatusCode)
            {
                NotifyView notifyView = new NotifyView();
                notifyView.ShowDialog();
                _Items.Remove(SelectedItem);
            }
        }
Exemplo n.º 6
0
        public HomePage()
        {
            // Use safe space (pad below statusbar on iOS)
            Page.SetUseSafeArea(On <Xamarin.Forms.PlatformConfiguration.iOS>(), true);

            // Navigation Bar
            NavigationPage.SetTitleView(this, new ToolbarView());

            // Main Background
            BackgroundColor = Colors.Background;

            // info slide-down
            var notifyView = new NotifyView()
            {
                BindingContext = NotifyCenter.Instance,
            };

            notifyView.SetBinding(NotifyView.MessageBindingContextProperty, nameof(NotifyCenter.Messages));

            // Content Layout
            var layout = new Grid
            {
                RowSpacing     = 0,
                RowDefinitions =
                {
                    new RowDefinition {
                        Height = GridLength.Star
                    },
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                },
                Children =
                {
                    { ContentView(), 0, 0 },
                    { TabPanel(),    0, 1 },
                    { notifyView,    0, 0 }, // overlay notify center
                },
            };

            Content = layout;
            Utils.Accessibility.Unused(Content);
        }