Esempio n. 1
0
        //FIXME: this should be private and done on Draw()
        public void Populate(object sender, EventArgs args)
        {
            Widget [] dead_pool = Children;
            for (int i = 0; i < dead_pool.Length; i++)
            {
                dead_pool [i].Destroy();
            }

            foreach (var app in ApplicationsFor(type_fetcher()))
            {
                var i = new AppMenuItem(app, ShowIcons);
                i.Activated += HandleItemActivated;
                Append(i);
            }

            if (Children.Length == 0)
            {
                MenuItem none = new Gtk.MenuItem(Strings.NoApplicationsAvailable)
                {
                    Sensitive = false
                };
                Append(none);
            }

            ShowAll();
        }
Esempio n. 2
0
        /// <summary>
        /// Crea un nodo del menú
        /// </summary>
        /// <param name="item">Item del menú</param>
        /// <param name="request">Solicitud actual</param>
        /// <param name="urlHelper">Helper para url</param>
        /// <returns>html en string</returns>
        internal static string CreateNode(AppMenuItem item, HttpRequest request, UrlHelper urlHelper)
        {
            var sb = new StringBuilder();

            if (item.Children == null)
            {
                item.Children = new List <AppMenuItem>();
            }
            item.Children = item.Children.OrderBy(x => x.Order).ToList();
            if (item.Children.Count == 0)
            {
                //Nodo simple
                var serverPath = urlHelper.Content($"~/{item.PathToResource}");
                var nodeString = $"<li><a href=\"{serverPath}\">{item.Name}</a></li>";
                sb.Append(nodeString);
            }
            else
            {
                sb.Append("<li class= \"dropdown\">");
                var serverPath = urlHelper.Content($"~/{item.PathToResource}");
                sb.Append($"<a href=\"{serverPath}\" class=\"dropdown-toggle\" data-toggle=\"dropdown\" role=\"button\" aria-haspopup=\"true\" aria-expanded=\"false\">{item.Name}<span class=\"caret\"></span></a>");
                sb.Append("<ul class=\"dropdown-menu\">");
                foreach (var child in item.Children)
                {
                    serverPath = urlHelper.Content($"~/{child.PathToResource}");
                    var nodeString = CreateNode(child, request, urlHelper);
                    sb.Append(nodeString);
                }
                sb.Append("</ul>");
                sb.Append("</li>");
            }

            return(sb.ToString());
        }
Esempio n. 3
0
 public void Update(AppMenuItem menuItem)
 {
     if (!_context.Exists(menuItem))
     {
         _context.MenuItems.Attach(menuItem);
     }
     _context.Entry(menuItem).State = EntityState.Modified;
 }
Esempio n. 4
0
    private void HandleItemActivated(object sender, EventArgs args)
    {
        AppMenuItem app = (sender as AppMenuItem);

        if (ApplicationActivated != null)
        {
            ApplicationActivated(app.App);
        }
    }
        public TopPanel()
        {
            this.InitializeComponent();
            //App.AppViewModel.CurrentTopPanel = this;
            var menus = AppMenuItem.GetTopMenuItems();

            MenuItemCollection.Clear();
            menus.ForEach(p => MenuItemCollection.Add(p));
            //TopMenuListView.SelectedItem = App.AppViewModel.SelectedSideMenuItem = menus.Where(p => p.IsSelected).FirstOrDefault();
        }
Esempio n. 6
0
        void ShowAbout(object sender, System.EventArgs e)
        {
            MenuItemsList.SelectedItem = _lastSelectedItem = null;
            var prevDetail = Detail as ContentPage;

            Detail = new NavigationPage(new AboutPage());
            CleanupPreviousDetailPage(prevDetail);

            IsPresented = false;
        }
Esempio n. 7
0
        public void UpdateMenuItems(ToolStripItemCollection items)
        {
            foreach (ToolStripItem item in items)
            {
                ToolStripMenuItem mitem = item as ToolStripMenuItem;
                if (mitem == null)
                {
                    continue;
                }
                this.UpdateMenuItems(mitem.DropDownItems);

                mitem.Checked = false;

                if (mitem is AppMenuItem)
                {
                    AppMenuItem appItem = mitem as AppMenuItem;
                    switch (appItem.Action)
                    {
                    case AppAction.ChartCandleSticks:
                        break;

                    case AppAction.ChartBarChart:
                        break;

                    case AppAction.ChartLineChart:
                        break;

                    case AppAction.ChartAutoScroll:
                        break;

                    case AppAction.ChartChartShift:
                        break;

                    case AppAction.ChartGrid:
                        break;

                    case AppAction.ChartPeriodSeparators:
                        break;

                    case AppAction.ChartZoomIn:
                        break;

                    case AppAction.ChartZoomOut:
                        break;
                    }
                }
                else if (mitem is TimeFrameMenuItem)
                {
                    TimeFrame         tf = _currentChartDocument.ChartControl.TimeFrame;
                    TimeFrameMenuItem timeFrameMenuItem = mitem as TimeFrameMenuItem;
                    timeFrameMenuItem.Checked = tf.Second == timeFrameMenuItem.TimeFrame.Second;
                }
            }
        }
        public SidePanel()
        {
            this.InitializeComponent();
            App.AppViewModel.CurrentSidePanel = this;
            var list = AppMenuItem.GetSideMenuItems(App.BiliViewModel.IsLogin);

            list.ForEach(p => MenuItemCollection.Add(p));
            App.AppViewModel.SelectedSideMenuItem = list.Where(p => p.IsSelected).FirstOrDefault();
            App.BiliViewModel.IsLoginChanged     -= IsLoginChanged;
            App.BiliViewModel.IsLoginChanged     += IsLoginChanged;
        }
        private void IsLoginChanged(object sender, bool e)
        {
            SideMenuListView.SelectedIndex = -1;
            var selectItem = MenuItemCollection.Where(p => p.IsSelected).FirstOrDefault();
            var type       = selectItem == null ? AppMenuItemType.Line : selectItem.Type;
            var list       = AppMenuItem.GetSideMenuItems(e, type);

            MenuItemCollection.Clear();
            list.ForEach(p => MenuItemCollection.Add(p));
            var select = MenuItemCollection.Where(p => p.IsSelected).FirstOrDefault();

            SideMenuListView.SelectedItem = App.AppViewModel.SelectedSideMenuItem = select;
        }
Esempio n. 10
0
    public void Populate(object sender, EventArgs args)
    {
        string [] mime_types = mime_fetcher();

        //foreach (string mime in mime_types)
        //	System.Console.WriteLine ("Populating open with menu for {0}", mime);

        if (this.mime_types != mime_types && populated)
        {
            populated = false;

            Widget [] dead_pool = Children;
            for (int i = 0; i < dead_pool.Length; i++)
            {
                dead_pool [i].Destroy();
            }
        }

        if (populated)
        {
            return;
        }

        ArrayList union, intersection;

        ApplicationsFor(this, mime_types, out union, out intersection);

        ArrayList list = (HideInvalid) ? intersection : union;

        foreach (MimeApplication app in list)
        {
            //System.Console.WriteLine ("Adding app {0} to open with menu (binary name = {1}", app.Name, app.BinaryName);
            //System.Console.WriteLine ("Desktop file path: {0}, id : {1}", app.DesktopFilePath);
            AppMenuItem i = new AppMenuItem(this, app);
            i.Activated += HandleItemActivated;
            // Make it not sensitive it we're showing everything
            i.Sensitive = (HideInvalid || intersection.Contains(app));
            Append(i);
        }

        if (Children.Length == 0)
        {
            MenuItem none = new Gtk.MenuItem(Catalog.GetString("No applications available"));
            none.Sensitive = false;
            Append(none);
        }

        ShowAll();

        populated = true;
    }
Esempio n. 11
0
 void ShowPage(object sender, System.EventArgs e)
 {
     try
     {
         var appMenuItem = (sender as BindableObject).BindingContext as AppMenuItem;
         if (ShowPage(appMenuItem.PropertyName, appMenuItem.Title))
         {
             _lastSelectedItem = (AppMenuItem)MenuItemsList.SelectedItem;
         }
     }
     catch (Exception)
     {
         DisplayPageError();
     }
 }
Esempio n. 12
0
        public ToolStripItem[] CreateChartMenuItems()
        {
            List <ToolStripItem> menuItemList = new List <ToolStripItem>();

            menuItemList.Add(new AppMenuItem(AppAction.ChartCandleSticks));
            menuItemList.Add(new AppMenuItem(AppAction.ChartBarChart));
            menuItemList.Add(new AppMenuItem(AppAction.ChartLineChart));
            menuItemList.Add(new ToolStripSeparator());
            menuItemList.Add(new AppMenuItem(AppAction.ChartAutoScroll));
            menuItemList.Add(new AppMenuItem(AppAction.ChartChartShift));
            menuItemList.Add(new ToolStripSeparator());
            menuItemList.Add(new AppMenuItem(AppAction.ChartGrid));
            menuItemList.Add(new AppMenuItem(AppAction.ChartPeriodSeparators));
            menuItemList.Add(new ToolStripSeparator());
            menuItemList.Add(new AppMenuItem(AppAction.ChartZoomIn));
            menuItemList.Add(new AppMenuItem(AppAction.ChartZoomOut));
            menuItemList.Add(new ToolStripSeparator());
            menuItemList.Add(new AppMenuItem(AppAction.ChartSaveAsPicture));
            menuItemList.Add(new AppMenuItem(AppAction.ChartSaveAsReport));
            menuItemList.Add(new ToolStripSeparator());

            AppMenuItem chartTimeFramesMenuItem = new AppMenuItem(AppAction.ChartTimeFrames);

            menuItemList.Add(chartTimeFramesMenuItem);
            foreach (TimeFrame tf in TimeFrameManager.TimeFrames)
            {
                TimeFrameMenuItem timeFrameMenuItem = new TimeFrameMenuItem(tf);
                timeFrameMenuItem.Click += new EventHandler(timeFrameMenuItem_Click);
                chartTimeFramesMenuItem.DropDownItems.Add(timeFrameMenuItem);
            }

            AppMenuItem chartTemplateMenuItem = new AppMenuItem(AppAction.ChartTemplate);

            chartTemplateMenuItem.DropDownItems.Add(new AppMenuItem(AppAction.ChartTemplateSave));
            chartTemplateMenuItem.DropDownItems.Add(new AppMenuItem(AppAction.ChartTemplateLoad));
            chartTemplateMenuItem.DropDownItems.Add(new AppMenuItem(AppAction.ChartTemplateRemove));
            menuItemList.Add(chartTemplateMenuItem);

            foreach (ToolStripItem item in menuItemList)
            {
                this.SetMenuItemClickEvent(item);
            }

            return(menuItemList.ToArray());
        }
	public void Populate (object sender, EventArgs args)
	{
		string [] mime_types = mime_fetcher ();

		//foreach (string mime in mime_types)
		//	System.Console.WriteLine ("Populating open with menu for {0}", mime);
		
		if (this.mime_types != mime_types && populated) {
			populated = false;

			Widget [] dead_pool = Children;
			for (int i = 0; i < dead_pool.Length; i++)
				dead_pool [i].Destroy ();
		}

		if (populated)
			return;

		ArrayList union, intersection;
		ApplicationsFor (this, mime_types, out union, out intersection);

		ArrayList list = (HideInvalid) ? intersection : union;

		foreach (MimeApplication app in list) {
			//System.Console.WriteLine ("Adding app {0} to open with menu (binary name = {1}", app.Name, app.BinaryName);
			//System.Console.WriteLine ("Desktop file path: {0}, id : {1}", app.DesktopFilePath);
			AppMenuItem i = new AppMenuItem (this, app);
			i.Activated += HandleItemActivated;
			// Make it not sensitive it we're showing everything
			i.Sensitive = (HideInvalid || intersection.Contains (app));
			Append (i);
		}
		
		if (Children.Length == 0) {
			MenuItem none = new Gtk.MenuItem (Catalog.GetString ("No applications available"));
			none.Sensitive = false;
			Append (none);
		}

		ShowAll ();

		populated = true;
	}
        private void OnLoaded(object obj)
        {
            var pagePanel = obj as PagePanel;

            var rootFrame = (Frame)pagePanel.FindName("PageFrame");

            if (rootFrame == null)
            {
                throw new Exception("Root frame not found");
            }

            NavigationService.Frame             = rootFrame;
            NavigationService.NavigationFailed += Frame_NavigationFailed;
            NavigationService.Navigated        += Frame_Navigated;

            var list = AppMenuItem.GetSideMenuItems(false);

            MenuItemCollection = new ObservableCollection <AppMenuItem>(list);

            rootFrame.Navigate(typeof(HomePage));
        }
Esempio n. 15
0
        //FIXME: this should be private and done on Draw()
        public void Populate(object sender, EventArgs args)
        {
            Widget [] dead_pool = Children;
            for (int i = 0; i < dead_pool.Length; i++)
            {
                dead_pool [i].Destroy();
            }

            foreach (AppInfo app in ApplicationsFor(type_fetcher()))
            {
                AppMenuItem i = new AppMenuItem(app, show_icons);
                i.Activated += HandleItemActivated;
                Append(i);
            }

            if (Children.Length == 0)
            {
                MenuItem none = new Gtk.MenuItem(Catalog.GetString("No applications available"));
                none.Sensitive = false;
                Append(none);
            }

            ShowAll();
        }
        //FIXME: this should be private and done on Draw()
        public void Populate(object sender, EventArgs args)
        {
            Widget [] dead_pool = Children;
            for (int i = 0; i < dead_pool.Length; i++)
                dead_pool [i].Destroy ();

            foreach (AppInfo app in ApplicationsFor (type_fetcher ())) {
                AppMenuItem i = new AppMenuItem (app, show_icons);
                i.Activated += HandleItemActivated;
                Append (i);
            }

            if (Children.Length == 0) {
                MenuItem none = new Gtk.MenuItem (Catalog.GetString ("No applications available"));
                none.Sensitive = false;
                Append (none);
            }

            ShowAll ();
        }
Esempio n. 17
0
 public void Delete(AppMenuItem menuItem)
 {
     _context.Entry(menuItem).State = EntityState.Deleted;
 }
Esempio n. 18
0
        private void MenuItem_Click(object sender, EventArgs e)
        {
            AppMenuItem menuItem = sender as AppMenuItem;

            SetTabItem(menuItem.BookNumber, menuItem.ChapterNumber, 0, false);
        }
Esempio n. 19
0
 public MenuItemEventArgs(AppMenuItem item)
 {
     SelectedItem = item;
 }
Esempio n. 20
0
 public void Add(AppMenuItem menuItem)
 {
     _context.MenuItems.Add(menuItem);
 }
 private void NavigateMenu(AppMenuItem obj)
 {
     obj.NavigationAction.Invoke();
     AppMenus.ForEach(x => x.IsSelected = false);
     obj.IsSelected = true;
 }