Beispiel #1
0
        public static void SaveApplicationSettings(string fileName)
        {
            GSCore rcs = GCUserInterface.windowController.ExecuteMessage("getMainRectangle", (GSCore)null);

            XmlDocument doc = new XmlDocument();
            XmlElement  e1  = doc.CreateElement("AppSettings");

            doc.AppendChild(e1);

            e1.AppendChild(doc.CreateElement("MyLocation"));
            myLocation.SaveToNode(e1["MyLocation"]);

            e1.AppendChild(doc.CreateElement("RecentLocations"));
            foreach (GCLocation loc in recentLocations)
            {
                XmlElement e2 = doc.CreateElement("RecentLocation");
                e1.AppendChild(e2);
                loc.SaveToNode(e2);
            }

            e1.AppendChild(doc.CreateElement("MainRectangle"));
            e1["MainRectangle"].SetAttribute("value", rcs.getStringValue());

            e1.AppendChild(doc.CreateElement("ShowMode"));
            e1["ShowMode"].SetAttribute("value", GCUserInterface.ShowMode.ToString());

            e1.AppendChild(doc.CreateElement("LayoutSize"));
            e1["LayoutSize"].SetAttribute("value", GCLayoutData.LayoutSizeIndex.ToString());

            e1.AppendChild(doc.CreateElement("LastRatedSpec"));
            e1["LastRatedSpec"].SetAttribute("value", dialogLastRatedSpec);

            doc.Save(fileName);
        }
Beispiel #2
0
        private void RescanPages()
        {
            string[]      propertiesToEdit = richTextBox1.Lines;
            StringBuilder sb = new StringBuilder();

            for (int i = 0; i < listBox1.Items.Count; i++)
            {
                if (listBox1.GetSelected(i))
                {
                    PageProxy pp = (PageProxy)listBox1.Items[i];
                    foreach (string s in propertiesToEdit)
                    {
                        GSCore prop = pp.page.GetPropertyValue(s);
                        if (!(prop is GSVoid))
                        {
                            sb.AppendFormat("@{0},{1}\n{2}\n", pp.page.Id, s, prop.getStringValue());
                        }
                    }
                }
            }

            if (sb.ToString().Equals(richTextBox2.Text))
            {
                return;
            }

            richTextBox2.Text = sb.ToString();
        }
Beispiel #3
0
        protected override GSCore ExecuteMessageSet(GSCore a1, GSCore a2, GSCoreCollection args)
        {
            string s = a1.getStringValue();

            if (s.Equals("drawings"))
            {
                Drawings = a2.getStringValue();
                return(a2);
            }

            return(base.ExecuteMessageSet(a1, a2, args));
        }
Beispiel #4
0
        protected override GSCore ExecuteMessageSet(GSCore a1, GSCore a2, GSCoreCollection args)
        {
            switch (a1.getStringValue())
            {
            case "rich":
                RichContent = a2.getBooleanValue();
                break;

            default:
                return(base.ExecuteMessageSet(a1, a2, args));
            }
            return(a2);
        }
Beispiel #5
0
        public string ResolveProperty(string p)
        {
            GSCore c = null;

            if (HasViewer)
            {
                c = Viewer.ResolveProperty(p);
            }
            else
            {
                c = EvaluateProperty(p);
            }
            return(c.getStringValue());
        }
Beispiel #6
0
        protected override GSCore ExecuteMessageSet(GSCore a1, GSCore a2, GSCoreCollection args)
        {
            string s = a1.getStringValue();

            if (s.Equals("columns"))
            {
                Columns = (int)a2.getIntegerValue();
                return(a2);
            }
            else if (s.Equals("navigbuttons"))
            {
                ShowNavigationButtons = a2.getBooleanValue();
                return(a2);
            }
            else
            {
                return(base.ExecuteMessageSet(a1, a2, args));
            }
        }
Beispiel #7
0
        public string GetTextWithoutPropertyTitle()
        {
            string[]      propertiesToEdit = richTextBox1.Lines;
            StringBuilder sb = new StringBuilder();

            for (int i = 0; i < listBox1.Items.Count; i++)
            {
                if (listBox1.GetSelected(i))
                {
                    PageProxy pp = (PageProxy)listBox1.Items[i];
                    foreach (string s in propertiesToEdit)
                    {
                        GSCore prop = pp.page.GetPropertyValue(s);
                        if (!(prop is GSVoid))
                        {
                            sb.AppendLine();
                            sb.AppendLine(prop.getStringValue());
                        }
                    }
                }
            }
            sb.AppendLine();
            return(sb.ToString());
        }
        public override GSCore ExecuteMessage(string token, GSCoreCollection args)
        {
            switch (token)
            {
            case "showTipAtStartup":
                if (Properties.Settings.Default.ShowStartupTips)
                {
                    TipOfDayPanelController dc = new TipOfDayPanelController(new HelpTipOfDayPanel());
                    dc.ViewContainer = ViewContainer;
                    ViewContainer.AddControl(dc, GVControlAlign.Center);
                }
                break;

            case "showTipOfTheDay":
            {
                TipOfDayPanelController dc = new TipOfDayPanelController(new HelpTipOfDayPanel());
                dc.ViewContainer = ViewContainer;
                ViewContainer.AddControl(dc, GVControlAlign.Center);
            }
            break;

            case "getMainRectangle":
                Rectangle rc = frame.Bounds;
                string    rs = string.Format("{0}|{1}|{2}|{3}", rc.Left, rc.Top, rc.Right, rc.Bottom);
                return(new GSString(rs));

            case "setMainRectangle":
            {
                GSCore   a2 = args.getSafe(0);
                string   s  = a2.getStringValue();
                string[] sa = s.Split('|');
                if (sa.Length == 4)
                {
                    int[] si  = new int[4];
                    int   res = 0;
                    for (int j = 0; j < 4; j++)
                    {
                        if (int.TryParse(sa[j], out si[j]))
                        {
                            res++;
                        }
                    }
                    if (res == 4)
                    {
                        Rectangle r = new Rectangle(si[0], si[1], si[2], si[3]);
                        frame.Bounds = r;
                    }
                }
            }
            break;

            case "printContents":
            {
                TResultBase tb = args.getSafe(0) as TResultBase;
                if (tb != null)
                {
                    frame.PrintContentPlain(tb);
                }
            }
            break;

            case GVTabBanner.MsgTabWillHide:
            {
                GSCore a2 = args.getSafe(0);
                switch (a2.getStringValue())
                {
                case "app":
                    if (appTab != null)
                    {
                        appTab.ExecuteMessage("saveSettings");
                        DisplaySettingsChanged = true;
                        frame.RefreshTitleText();
                    }
                    break;
                }
            }
            break;

            case GVTabBanner.MsgTabChanged:
            {
                GSCore a2 = args.getSafe(0);
                switch (a2.getStringValue())
                {
                case "app":
                    if (appTab == null)
                    {
                        ApplicationTab at = new ApplicationTab();
                        appTab = new ApplicationTabController(at);
                    }
                    frame.TabBanner.RemoveAll();
                    appTab.ShowInContainer(frame.TabBanner, GVControlAlign.Fill);
                    currentObject = appTab.ExecuteMessage("getCurrentContent") as TResultBase;
                    break;

                case "search":
                    if (searchTab == null)
                    {
                        searchTab = new SearchTabController(new SearchTab());
                    }
                    frame.TabBanner.RemoveAll();
                    searchTab.ShowInContainer(frame.TabBanner, GVControlAlign.Fill);
                    break;

                case "cal":
                    if (calendarTab == null)
                    {
                        calendarTab = new CalendarTabController(new CalendarTab());
                    }
                    frame.TabBanner.RemoveAll();
                    calendarTab.ShowInContainer(frame.TabBanner, GVControlAlign.Fill);
                    currentObject = calendarTab.ExecuteMessage("getCurrentContent") as TResultBase;
                    if (DisplaySettingsChanged)
                    {
                        calendarTab.getView().Recalculate();
                        DisplaySettingsChanged = false;
                    }
                    break;

                case "events":
                    if (coreEventsTab == null)
                    {
                        coreEventsTab = new CoreEventsTabController(new CoreEventsTab());
                    }
                    frame.TabBanner.RemoveAll();
                    coreEventsTab.ShowInContainer(frame.TabBanner, GVControlAlign.Fill);
                    currentObject = coreEventsTab.ExecuteMessage("getCurrentContent") as TResultBase;
                    if (DisplaySettingsChanged)
                    {
                        coreEventsTab.getView().Recalculate();
                        DisplaySettingsChanged = false;
                    }
                    break;

                case "appday":
                    if (appDayTab == null)
                    {
                        AppDayTab adt = new AppDayTab();
                        appDayTab = new AppDayTabController(adt);
                    }
                    frame.TabBanner.RemoveAll();
                    appDayTab.ShowInContainer(frame.TabBanner, GVControlAlign.Fill);
                    currentObject = appDayTab.ExecuteMessage("getCurrentContent") as TResultBase;
                    if (DisplaySettingsChanged)
                    {
                        appDayTab.getView().Recalculate();
                        DisplaySettingsChanged = false;
                    }
                    break;

                case "masalist":
                    if (masaTab == null)
                    {
                        masaTab = new MasaListTabController(new MasaListTab());
                    }
                    frame.TabBanner.RemoveAll();
                    masaTab.ShowInContainer(frame.TabBanner, GVControlAlign.Fill);
                    currentObject = masaTab.ExecuteMessage("getCurrentContent") as TResultBase;
                    if (DisplaySettingsChanged)
                    {
                        masaTab.getView().Recalculate();
                        DisplaySettingsChanged = false;
                    }
                    break;

                case "today":
                    if (todayTab == null)
                    {
                        todayTab = new TodayTabController(new TodayTab());
                    }
                    frame.TabBanner.RemoveAll();
                    todayTab.ShowInContainer(frame.TabBanner, GVControlAlign.Fill);
                    currentObject = todayTab.ExecuteMessage("getCurrentContent") as TResultBase;
                    if (DisplaySettingsChanged)
                    {
                        todayTab.getView().Recalculate();
                        DisplaySettingsChanged = false;
                    }
                    break;

                case "ratedevents":
                    if (ratedTab == null)
                    {
                        ratedTab = new RatedEventsTabController(new RatedEventsTab());
                    }
                    frame.TabBanner.RemoveAll();
                    ratedTab.ShowInContainer(frame.TabBanner, GVControlAlign.Fill);
                    currentObject = ratedTab.ExecuteMessage("getCurrentContent") as TResultBase;
                    if (DisplaySettingsChanged)
                    {
                        ratedTab.getView().Recalculate();
                        DisplaySettingsChanged = false;
                    }
                    break;

                default:
                    break;
                }
            }
            break;

            case "print":
                frame.PrintContentPlain();
                break;

            case "save":
                frame.SaveContentPlain();
                break;

            case "helpAbout":
            {
                HelpAboutPanelController hpc = new HelpAboutPanelController(new HelpAboutPanel());
                hpc.ViewContainer = ViewContainer;
                ViewContainer.AddControl(hpc, GVControlAlign.Center);
            }
            break;

            case "windowOpen":
                FrameMain frame1 = new FrameMain();
                frame1.Icon = Properties.Resources.GCalIcon2;
                frame1.Text = "GCAL (secondary)";
                frame1.Show();
                break;

            case "windowClose":
                frame.Close();
                break;

            case "getCurrentContent":
                return(currentObject);

            default:
                break;
            }

            return(GSCore.Void);
        }
        public override GSCore ExecuteMessage(string token, GSCoreCollection args)
        {
            if (token.Equals("setTabChanged"))
            {
                token = GVListBanner.MsgListItemChanged;
            }

            if (token.Equals(GVListBanner.MsgListItemChanged))
            {
                GSCore a1 = args.getSafe(0);
                switch (a1.getStringValue())
                {
                case "dispSetGeneral":
                    if (dsGeneral == null)
                    {
                        dsGeneral = new DispSetGeneralDelegate(new DispSetGeneral());
                    }
                    currentPanelDisplayed = dsGeneral;
                    ShowPanel(dsGeneral, GVControlAlign.Scroll);
                    break;

                case "dispSetToday":
                    if (dsToday == null)
                    {
                        dsToday = new DispSetTodayDelegate(new DispSetToday());
                    }
                    currentPanelDisplayed = dsToday;
                    ShowPanel(dsToday, GVControlAlign.Scroll);
                    break;

                case "dispSetCalendar":
                    if (dsCalendar == null)
                    {
                        dsCalendar = new DispSetCalendarDelegate(new DispSetCalendar());
                    }
                    currentPanelDisplayed = dsCalendar;
                    ShowPanel(dsCalendar, GVControlAlign.Scroll);
                    break;

                case "dispSetCoreEvents":
                    if (dsCoreEvents == null)
                    {
                        dsCoreEvents = new DispSetCoreEventsDelegate(new DispSetCoreEvents());
                    }
                    currentPanelDisplayed = dsCoreEvents;
                    ShowPanel(dsCoreEvents, GVControlAlign.Scroll);
                    break;

                case "dispSetAppDay":
                    if (dsAppDay == null)
                    {
                        dsAppDay = new DispSetAppDayDelegate(new DispSetAppDay());
                    }
                    currentPanelDisplayed = dsAppDay;
                    ShowPanel(dsAppDay, GVControlAlign.Scroll);
                    break;

                case "locs":
                    if (locPanel == null)
                    {
                        locPanel = new LocationsPanelController(new LocationsPanel());
                    }
                    currentPanelDisplayed  = locPanel;
                    locPanel.ViewContainer = getView().ViewContainer;
                    ShowPanel(locPanel, GVControlAlign.Fill);
                    break;

                case "events":
                    if (evPanel == null)
                    {
                        EventsPanel ep = new EventsPanel();
                        evPanel = new EventsPanelDelegate(ep);
                        evPanel.ViewContainer = getView().ViewContainer;
                    }
                    currentPanelDisplayed = evPanel;
                    ShowPanel(evPanel, GVControlAlign.Fill);
                    break;

                case "cntr":
                    if (couPanel == null)
                    {
                        CountriesPanel cp = new CountriesPanel();
                        cp.ViewContainer = getView().ViewContainer;
                        couPanel         = new CountriesPanelDelegate(cp);
                    }
                    currentPanelDisplayed = couPanel;
                    ShowPanel(couPanel, GVControlAlign.Fill);
                    break;

                case "tzones":
                    if (timPanel == null)
                    {
                        timPanel = new TimezonesPanelDelegate(new TimezonesPanel());
                        timPanel.ViewContainer = getView().ViewContainer;
                    }
                    currentPanelDisplayed = timPanel;
                    ShowPanel(timPanel, GVControlAlign.Fill);
                    break;

                case "festivalBooks":
                    if (festPanel == null)
                    {
                        festPanel = new FestivalBooksPanelDelegate(new FestivalBooksPanel());
                        festPanel.ViewContainer = getView().ViewContainer;
                    }
                    currentPanelDisplayed = festPanel;
                    ShowPanel(festPanel, GVControlAlign.Fill);
                    break;

                case "save":
                case "print":
                case "showTipOfTheDay":
                case "helpAbout":
                case "windowOpen":
                case "windowClose":
                    if (Parent != null)
                    {
                        getView().SelectedIndexNoResponse = -1;
                        Parent.ExecuteMessage(a1.getStringValue());
                    }
                    break;

                case "help":
                    if (helpPanel == null)
                    {
                        helpPanel = new HelpPanelController(new HelpPanel());
                    }
                    ShowPanel(helpPanel, GVControlAlign.Fill);
                    helpPanel.ShowRichText(Properties.Resources.gcal_help);
                    break;

                default:
                    break;
                }
            }
            else if (token.Equals("currExec"))
            {
                if (currentPanelDisplayed != null)
                {
                    currentPanelDisplayed.ExecuteMessage(args.getSafe(0).getStringValue(), args.getSublist(1));
                }
            }
            else if (token.Equals("saveSettings"))
            {
                if (currentPanelDisplayed != null)
                {
                    currentPanelDisplayed.ExecuteMessage(GVControlContainer.MsgViewWillHide);
                }
            }
            else
            {
                return(base.ExecuteMessage(token, args));
            }

            return(GSCore.Void);
        }
Beispiel #10
0
        public override GSCore ExecuteMessage(string token, GSCoreCollection args)
        {
            string arg1 = string.Empty;

            switch (token)
            {
            case "invalidate":
                View.Invalidate();
                break;

            case "reload":
                //View.CurrentPage.RestoreStatus();
                View.ReloadPage(true);
                break;

            case "restart":
                View.Start();
                break;

            case "selectBook":
                if (View.CurrentDocument != null)
                {
                    View.CurrentDocument.SaveBookStatus();
                }
                View.mainFrameDelegate.SetShowPanel("files");
                break;

            case "showpage":
                arg1 = args.getSafe(0).getStringValue();
                if (arg1.Equals("#next"))
                {
                    GoForward();
                }
                else if (arg1.Equals("#back"))
                {
                    GoBack();
                }
                else
                {
                    ShowPage(arg1);
                }
                break;

            case "showPageMenu":
                View.InitializePageMenu();
                View.Invalidate();
                break;

            case "showmenu":
                MNMenu m = View.CurrentDocument.FindMenu(args.getSafe(0).getStringValue());
                if (m != null)
                {
                    View.DisplayedMenu = m;
                }
                break;

            case "changeLanguage":
                View.mainFrameDelegate.showSelectLanguageDialog(View.CurrentDocument);
                break;

            case "playSound":
                GSCore aif = args.getSafe(0);
                if (aif != null && aif is MNReferencedSound)
                {
                    View.PlaySound(aif as MNReferencedSound);
                }
                else if (aif != null && aif is GSString)
                {
                    MNReferencedSound sound = View.CurrentDocument.FindSound(aif.getStringValue());
                    if (sound != null)
                    {
                        View.PlaySound(sound);
                    }
                }
                break;

            case "scheduleClear":
                if (t.Enabled)
                {
                    t.Stop();
                }
                scheduled = null;
                break;

            case "scheduleCall":
                if (t.Enabled)
                {
                    t.Stop();
                }
                if (scheduled != null)
                {
                    scheduled.Target.ExecuteMessage(scheduled.Message, scheduled.Args);
                    scheduled = null;
                }
                if (args != null)
                {
                    int interval = (int)args.getSafe(0).getIntegerValue();
                    if (interval > 0 && interval < 200000)
                    {
                        scheduled         = new ScheduledTask();
                        scheduled.Target  = args.getSafe(1);
                        scheduled.Message = args.getSafe(2).getStringValue();
                        scheduled.Args    = args.getSublist(3);
                        t.Interval        = interval;
                        t.Start();
                    }
                }
                break;

            case "homePage":
                ShowPage(View.CurrentPage.Document.Book.HomePage);
                break;

            default:
                base.ExecuteMessage(token, args);
                break;
            }

            return(GSVoid.Void);
        }