Example #1
0
        public void add(CPage page)
        {
            _embeddedPages.Add(page);

            _currentIndex = 0;
            base.add(page);
        }
Example #2
0
 private void GetPage()
 {
     if (m_IdChapter == null)
     {
         m_oPage = m_oBook.GetPage(m_iActualPage);
     }
     else
     {
         CChapter oChapter = (CChapter)m_oBook.Chapter[m_IdChapter];
         m_oPage = oChapter.GetPage(m_iActualPage);
     }
 }
 private void PopulateCPage()
 {
     try
     {
         using (RockyingDataClassesDataContext dc = new RockyingDataClassesDataContext(Utility.ConnectionString))
         {
             CustomPage p = (from u in dc.CustomPages where u.ID == ID select u).SingleOrDefault();
             try
             {
                 cp               = Utility.Deserialize <CPage>(System.IO.File.ReadAllText(Server.MapPath(string.Format("{1}/cpagexml-{0}.txt", ID, Utility.CustomPageFolder))));
                 cp.CreatedBy     = p.CreatedBy;
                 cp.CreatedByName = p.Member.MemberName;
                 cp.DateCreated   = p.DateCreated;
                 if (p.ModifiedBy.HasValue)
                 {
                     cp.ModifiedBy     = p.ModifiedBy.Value;
                     cp.ModifiedByName = p.Member1.MemberName;
                 }
                 if (p.DateModified.HasValue)
                 {
                     cp.DateModified = p.DateModified.Value;
                 }
                 cp.Status = (PostStatusType)Enum.Parse(typeof(PostStatusType), p.Status.ToString());
                 cp.Name   = p.Name;
                 cp.ID     = p.ID;
             }
             catch (Exception inner)
             {
                 Trace.Write("Unable to load cpage details.");
                 Trace.Write(inner.Message);
                 Trace.Write(inner.StackTrace);
             }
         }
     }
     catch (Exception ex)
     {
         Trace.Write("Unable to load page details.");
         Trace.Write(ex.Message);
         Trace.Write(ex.StackTrace);
     }
 }
Example #4
0
        private void LoadPicturePage()
        {
            string sImage = "";

            splitContainer5.SplitterDistance = this.Width - 59;
            splitContainer1.SplitterDistance = this.Width - splitContainer5.Width - 1;


            if (pictureBox1.BackgroundImage != null)
            {
                pictureBox1.BackgroundImage.Dispose();
                pictureBox1.BackgroundImage = null;
                GC.Collect();
            }

            try
            {
                if (m_IdChapter == null)
                {
                    m_oPage = m_oBook.GetPage(m_iActualPage);
                }
                else
                {
                    CChapter oChapter = (CChapter)m_oBook.Chapter[m_IdChapter];
                    m_oPage = oChapter.GetPage(m_iActualPage);
                }
                sImage = CGenDef.BooksDir + "\\" + m_oBook.NameId + "\\" + m_oPage.Background;
                pictureBox1.BackgroundImage = new Bitmap(sImage);
            }
            catch
            {
                pictureBox1.BackgroundImage = new Bitmap(CGenDef.BooksDir + m_oBook.NameId + "\\cover.png");
            }


            if (pictureBox1.BackgroundImage.Width < this.Width - 119)
            {
                splitContainer1.SplitterDistance = this.Width - pictureBox1.BackgroundImage.Width - 59;
                splitContainer5.SplitterDistance = pictureBox1.BackgroundImage.Width;
            }
        }
Example #5
0
        public FBook(CBook oBook)
        {
            InitializeComponent();

            speaker = new SpeechSynthesizer();

            Program.EyeXHost.Connect(behaviorMap1);
            //behaviorMap1.Add(btNext, new EyeXFramework.GazeAwareBehavior(OnGaze));
            behaviorMap1.Add(btNext, new EyeXFramework.GazeAwareBehavior(OnGazeClick)
            {
                DelayMilliseconds = 2000
            });

            behaviorMap1.Add(btBack, new EyeXFramework.GazeAwareBehavior(OnGaze));
            behaviorMap1.Add(btBack, new EyeXFramework.ActivatableBehavior(OnButtonActivated));
            behaviorMap1.Add(richTextBox1, new EyeXFramework.GazeAwareBehavior(OnGazeRichTextBox));

            behaviorMap1.Add(button1, new EyeXFramework.GazeAwareBehavior(OnGazeWord));
            behaviorMap1.Add(button2, new EyeXFramework.GazeAwareBehavior(OnGazeWord));
            behaviorMap1.Add(button3, new EyeXFramework.GazeAwareBehavior(OnGazeWord));
            behaviorMap1.Add(button4, new EyeXFramework.GazeAwareBehavior(OnGazeWord));
            behaviorMap1.Add(button5, new EyeXFramework.GazeAwareBehavior(OnGazeWord));
            behaviorMap1.Add(button6, new EyeXFramework.GazeAwareBehavior(OnGazeWord));
            behaviorMap1.Add(button7, new EyeXFramework.GazeAwareBehavior(OnGazeWord));
            behaviorMap1.Add(button8, new EyeXFramework.GazeAwareBehavior(OnGazeWord));
            behaviorMap1.Add(button9, new EyeXFramework.GazeAwareBehavior(OnGazeWord));

            KeyDown += OnKeyDown;
            KeyUp   += OnKeyUp;

            m_oBook       = oBook;
            m_iActualPage = 1;
            m_oPage       = m_oBook.GetPage(m_iActualPage);
            GetPage();

            m_sWords = new string[] { "Halloween", "brincar", "pizza", "floresta", "porta", "barulho", "monstro", "televisão" };
            btNext.Select();
        }
Example #6
0
        private void GetPage()
        {
            richTextBox1.ResetText();
            m_oPage = m_oBook.GetPage(m_iActualPage);

            for (int i = 1; i < m_oPage.Lines.Count + 1; i++)
            {
                richTextBox1.AppendText("\n\n");
                richTextBox1.AppendText(m_oPage.GetLine(i).Text);
                richTextBox1.AppendText("\n");
            }

            richTextBox1.SelectAll();
            richTextBox1.SelectionAlignment = HorizontalAlignment.Center;

            btNext.Visible = m_iActualPage == m_oBook.Pages.Count ? false : true;
            btBack.Visible = m_iActualPage == 1 ? false : true;

            label1.Text = m_oBook.Name;
            label2.Text = m_oPage.PageId.ToString() + " de " + m_oBook.Pages.Count.ToString();

            SetEffectWord();
        }
Example #7
0
 private void dlgShow_Load(object sender, EventArgs e)
 {
     this.WindowState = FormWindowState.Maximized;
     try
     {
         myModule.fMain.initBanDo(this.AxMap1);
         this.myPages = new CPages();
         try
         {
             IEnumerator enumerator = myModule.fMain.myPages.GetEnumerator();
             while (enumerator.MoveNext())
             {
                 CPage cPage = (CPage)enumerator.Current;
                 this.myPages.AddNewPage(cPage.Symbols);
             }
         }
         finally
         {
             IEnumerator enumerator;
             if (enumerator is IDisposable)
             {
                 (enumerator as IDisposable).Dispose();
             }
         }
         this.PageCount = this.myPages.Count;
     }
     catch (Exception expr_84)
     {
         ProjectData.SetProjectError(expr_84);
         Exception ex = expr_84;
         MessageBox.Show("SaiRoi: " + ex.Message);
         this.Dispose();
         ProjectData.ClearProjectError();
     }
     this.AxMap1.ZoomTo(myModule.fMain.AxMap1.Zoom, myModule.fMain.AxMap1.CenterX, myModule.fMain.AxMap1.CenterY);
     this.ShowPage(this.iCurrPage);
 }
Example #8
0
 private void ShowPage(int pPageIndex)
 {
     this.Cursor = Cursors.WaitCursor;
     try
     {
         CPage cPage = this.myPages[pPageIndex];
         if (!Information.IsNothing(cPage))
         {
             this.m_DrawingSymbols = CSymbols.String2KHs(cPage.Symbols);
         }
         this.AxMap1.Refresh();
     }
     catch (Exception expr_40)
     {
         ProjectData.SetProjectError(expr_40);
         Exception ex = expr_40;
         Interaction.MsgBox(ex.Message, MsgBoxStyle.Critical, "Show Error");
         ProjectData.ClearProjectError();
     }
     this.Cursor    = Cursors.Default;
     this.iCurrPage = pPageIndex;
     this.AxMap1.Select();
     this.AxMap1.CurrentTool = ToolConstants.miPanTool;
 }
Example #9
0
 void removePage(CPage pg)
 {
     pg.mPre.mNext = pg.mNext;
     pg.mNext.mPre = pg.mPre;
     pg.detach();
 }
Example #10
0
 public CPage setPrePage()
 {
     if (mPageMain == null) return null;
     mPageCurrent = mPageCurrent.mPre;
     return mPageCurrent;
 }
Example #11
0
 public CPage setNextPage()
 {
     if (mPageMain == null) return null;
     mPageCurrent = mPageCurrent.mNext;
     return mPageCurrent;
 }
Example #12
0
        public CPage pushPage(string name)
        {
            CPage ret = null;
            if (mPageMain == null)
            {
                mPageMain = new CPage(name, mPages );
                mPageMain.mPre = mPageMain;
                mPageMain.mNext = mPageMain;
                mPageLast = mPageMain;
                mPageCurrent = mPageMain;
                ret = mPageCurrent;
            }
            else
            {
                mPageCurrent = new CPage(name, mPages);
                mPageCurrent.mPre = mPageLast;
                mPageLast.mNext = mPageCurrent;
                mPageCurrent.mNext = mPageMain;
                mPageMain.mPre = mPageCurrent;
                mPageLast = mPageCurrent;
                ret = mPageCurrent;
            }

            ret.mSplit.evtOnLMDownClear();
            Action<int, int> moveHandle = (x, y) =>
            {
                var dt = ret.mSplit.updateFixpointDelta(x, y);
                //Console.WriteLine(dt.X);
                ret.mRoot.width = ret.mRoot.width + dt.X;
                ret.mNext.mRoot.width = ret.mNext.mRoot.width - dt.X;

                //Console.WriteLine(ret.mRoot.width);
                UIRoot.Instance.root.adjustLayout();
                ret.mSplit.beginFixpoint(x, y);
                ret.mRoot.attrs["oringWidth"] = ret.mRoot.width;
                ret.mRoot.setDirty(true);
            };

            Action<int, int> upHandle = null; ;
            upHandle = (x, y) =>
            {
                UIRoot.Instance.evtMove -= moveHandle;
                UIRoot.Instance.evtLeftUp -= upHandle;
            };
            mPageCurrent.mSplit.evtOnLMDown += (ui, x, y) =>
                {
                    ret.mSplit.beginFixpoint(x, y);
                    ret.mRoot.attrs["oringWidth"] = ret.mRoot.width;
                    ret.mSplit.attrs["oringPx"] = ret.mSplit.px;
                    UIRoot.Instance.evtMove += moveHandle;
                    UIRoot.Instance.evtLeftUp += upHandle;
                    return false;
                };
            relayoutPages();
            return mPageCurrent;
        }
Example #13
0
 public void popPage()
 {
     if (mPageMain == null) return;
     if (mPageLast == mPageMain) return;
     removePage(mPageLast);
     if (mPageCurrent == mPageLast)
     {
         mPageCurrent = mPageLast.mPre;
     }
     mPageLast = mPageLast.mPre;
 }
Example #14
0
 public void remove(CPage page)
 {
     _embeddedPages.Remove(page);
     base.remove(page);
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            HPM = null;
            string pname = "home";
            if (Page.RouteData.Values["pagename"] != null)
            {
                pname = Page.RouteData.Values["pagename"].ToString();
            }
            if (pname != "home")
            {
                using (RockyingDataClassesDataContext dc = new RockyingDataClassesDataContext(Utility.ConnectionString))
                {
                    int pid = (from u in dc.CustomPages where u.Name == pname && u.Status == (byte)PostStatusType.Publish select u.ID).SingleOrDefault();
                    CP = Utility.Deserialize <CPage>(System.IO.File.ReadAllText(Server.MapPath(string.Format("{1}/cpagexml-{0}.txt", pid, Utility.CustomPageFolder))));

                    Master.NoTemplate = CP.NoTemplate;

                    #region Replace Custom Data Source
                    DataSourceManager dsm = new DataSourceManager();
                    CP.Body = dsm.ParseAndPopulate(CP.Body);
                    #endregion
                }
            }
            else
            {
                HPM = new HomePageModel();
                using (RockyingDataClassesDataContext dc = new RockyingDataClassesDataContext(Utility.ConnectionString))
                {
                    var items = (from t in dc.Posts
                                 where t.Status == (byte)PostStatusType.Publish
                                 orderby t.DateCreated descending
                                 select t).Take(9);
                    foreach (var i in items)
                    {
                        Article a = new Article();
                        a.Category      = i.Category;
                        a.CategoryName  = i.Category1.Name;
                        a.CreatedBy     = i.CreatedBy;
                        a.CreatedByName = i.Member.MemberName;
                        a.DateCreated   = i.DateCreated;
                        a.DateModified  = i.DateModified;
                        a.Description   = i.Description;
                        a.ID            = i.ID;
                        a.ModifiedBy    = i.ModifiedBy;
                        a.Status        = (PostStatusType)i.Status;
                        a.Tag           = i.Tag;
                        a.Text          = string.Empty;
                        a.Title         = i.Title;
                        a.OGImage       = Utility.TrimStartHTTP(i.OGImage);
                        a.OGDescription = i.OGDescription;
                        a.WriterEmail   = i.WriterEmail;
                        a.WriterName    = i.WriterName;
                        a.Viewed        = i.Viewed;
                        a.URL           = i.URL;
                        HPM.LatestList.Add(a);
                    }
                    var top = from t in dc.TopStories orderby t.DateCreated descending select t;
                    foreach (var i in top)
                    {
                        Article a = new Article();
                        a.Category      = i.Post.Category;
                        a.CategoryName  = i.Post.Category1.Name;
                        a.CreatedBy     = i.Post.CreatedBy;
                        a.CreatedByName = i.Post.Member.MemberName;
                        a.DateCreated   = i.Post.DateCreated;
                        a.DateModified  = i.Post.DateModified;
                        a.Description   = i.Post.Description;
                        a.ID            = i.Post.ID;
                        a.ModifiedBy    = i.Post.ModifiedBy;
                        a.Status        = (PostStatusType)i.Post.Status;
                        a.Tag           = i.Post.Tag;
                        a.Text          = string.Empty;
                        a.Title         = i.Post.Title;
                        a.OGImage       = Utility.TrimStartHTTP(i.Post.OGImage);
                        a.OGDescription = i.Post.OGDescription;
                        a.WriterEmail   = i.Post.WriterEmail;
                        a.WriterName    = i.Post.WriterName;
                        a.URL           = i.Post.URL;
                        HPM.HeroList.Add(a);
                    }
                }
            }
        }
        catch (Exception ex)
        {
            CP      = new CPage();
            CP.Body = Resources.Resource._404;
            Trace.Write("Invalid pagename");
            Trace.Write(ex.Message);
            Trace.Write(ex.StackTrace);
        }
    }
Example #16
0
 public void remove(CPage page)
 {
     _embeddedPages.Remove(page);
       base.remove(page);
 }
Example #17
0
        public void add(CPage page)
        {
            _embeddedPages.Add(page);

              _currentIndex = 0;
              base.add(page);
        }