//PageTemplate pageTemplate, Int32 pageId
 public InsertToPage(Frame mainFrame, Grid mainContainer, DPage dPage, PageTemplate pageTemplate)
 {
     this.mainFrame     = mainFrame;
     this.mainContainer = mainContainer;
     this.dPage         = dPage;
     pageTemplate1      = pageTemplate;
 }
        /*
         * 保存数据
         */
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            DPage dPage = new DPage();

            dPage.name     = pagename.Text;
            dPage.parentId = parentId;
            if (string.IsNullOrWhiteSpace(dPage.name))
            {
                MessageBox.Show("请填写页面名称");
                return;
            }
            else if (dPage.parentId == 0)
            {
                MessageBox.Show("父页面不存在,请重试");
                return;
            }
            ComboBoxItem item = (ComboBoxItem)pageSwitchType.SelectedItem;
            int          pageSwitchTypeVal = 0;

            if (item != null)
            {
                pageSwitchTypeVal = (int)item.Tag;
            }
            dPage.pageSwitchType = pageSwitchTypeVal;

            dPage = dPageBll.insertChild(dPage);
            if (App.localStorage.cfg.pageSwitchType != dPage.pageSwitchType)
            {
                App.localStorage.cfg.pageSwitchType = dPage.pageSwitchType;
                cfgBll.update(App.localStorage.cfg);
            }

            insertToTree(pageTreeColumn, dPage);
            Close();
        }
예제 #3
0
        /*
         * 初始化页面列表
         */
        private void initCombox(int pageId, int currLinkToPageId)
        {
            DPage firstDPage = dPageBll.get(1);
            //int currLinkToPageId = 2;

            ComboBoxItem defaultItem = new ComboBoxItem();

            defaultItem.Content = "-- 请选择 --";
            defaultItem.Tag     = 0;
            if (0 == currLinkToPageId)
            {
                defaultItem.IsSelected = true;
            }
            linkToPageId.Items.Add(defaultItem);

            ComboBoxItem firstItem = new ComboBoxItem();

            firstItem.Content = firstDPage.name;
            firstItem.Tag     = firstDPage.id;
            if (firstDPage.id == currLinkToPageId)
            {
                firstItem.IsSelected = true;
            }
            if (firstDPage.id == pageId)
            {
                //归属页面,不可选
                firstItem.IsEnabled = false;
            }
            linkToPageId.Items.Add(firstItem);

            int lv = 0;

            getTreeViewItemChildren(firstItem, lv, currLinkToPageId, pageId);
        }
예제 #4
0
        /*
         * 保存数据
         */
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            DPage thatPage = dPageBll.get(thatPageId);


            DPage dPage = new DPage();

            dPage.name     = pagename.Text;
            dPage.parentId = thatPage.parentId;
            dPage.idx      = thatPage.idx + 1;

            if (string.IsNullOrWhiteSpace(dPage.name))
            {
                MessageBox.Show("请填写页面名称");
                return;
            }
            else if (string.IsNullOrWhiteSpace(thatPage.name))
            {
                MessageBox.Show("同级页面不存在,请重试");
                return;
            }
            dPage = dPageBll.insertAfter(dPage);

            insertToTree(pageTreeColumn, dPage);

            Close();
        }
예제 #5
0
        public async Task <ActionResult> Config(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                return(View());
            }
            else
            {
                var config = db.DPages.Find(id);
                if (config == null)
                {
                    config = new DPage
                    {
                        Id         = id,
                        CreatorId  = User.Identity.GetUserId(),
                        LastModify = DateTime.UtcNow
                    }
                }
                ;
                await db.SaveAsync();

                return(View("Pages", new DPageViewModel
                {
                    Id = config.Id,
                    Name = config.Name,
                    Content = config.Content
                }));
            }
        }
예제 #6
0
        //3、添加子页面
        public DPage insert(DPage entity)
        {
            String sql = "insert into dPage(name,parentId,idx,createTime,backgroundImageId,width,height,pageSwitchType,backgroundVideoId) values(@name,@parentId,@idx,@createTime,@backgroundImageId,@width,@height,@pageSwitchType,@backgroundVideoId);select last_insert_rowid();";

            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@name",              DbType.String, 100),
                new SQLiteParameter("@parentId",          DbType.Int32,    4),
                new SQLiteParameter("@idx",               DbType.Int32,    4),
                new SQLiteParameter("@createTime",        DbType.String,  30),
                new SQLiteParameter("@backgroundImageId", DbType.Int32,    4),
                new SQLiteParameter("@width",             DbType.Int32,    4),
                new SQLiteParameter("@height",            DbType.Int32,    4),
                new SQLiteParameter("@pageSwitchType",    DbType.Int32,    4),
                new SQLiteParameter("@backgroundVideoId", DbType.Int32, 4)
            };
            parameters[0].Value = entity.name;
            parameters[1].Value = entity.parentId;
            parameters[2].Value = entity.idx;
            parameters[3].Value = entity.createTime;
            parameters[4].Value = entity.backgroundImageId;
            parameters[5].Value = entity.width;
            parameters[6].Value = entity.height;
            parameters[7].Value = entity.pageSwitchType;
            parameters[8].Value = entity.backgroundVideoId;

            DataTable dt = Common.SQLiteHelper.ExecuteQuery(sql, parameters);
            int       id = DataType.ToInt32(dt.Rows[0]["last_insert_rowid()"].ToString());

            entity.id = id;
            return(entity);
        }
예제 #7
0
        /*
         * 初始化页面控件
         */
        private void initControl()
        {
            //如果页面不存在,则显示透明背景

            //scrollViewer 内嵌Frame
            // if (ctl.linkToPageId <= 0) return;
            DPage dPage1 = dPageBll.get(currDControl.linkToPageId);
            //  if (dPage1 == null) return;
            int frameWidth  = App.localStorage.cfg.screenWidth;
            int frameHeight = App.localStorage.cfg.screenHeight;

            if (dPage1 != null && dPage1.width > 0)
            {
                frameWidth = dPage1.width;
            }
            if (dPage1 != null && dPage1.height > 0)
            {
                frameHeight = dPage1.height;
            }
            mainFrame.Width  = frameWidth;
            mainFrame.Height = frameHeight;


            PageTemplate pageTemplate = new PageTemplate(mainFrame, currDControl.linkToPageId, false, currDControl.isTransparentDialog, screen, mqServer);

            mainFrame.Content = pageTemplate;
        }
예제 #8
0
        /*
         * 初始化页面列表
         */
        private void initCombox_linkToPageId(ComboBox comboBoxLinkToPageId, int currLinkToPageId)
        {
            DPage firstDPage = dPageBll.get(1);

            ComboBoxItem defaultItem = new ComboBoxItem();

            defaultItem.Content = "-- 请选择 --";
            defaultItem.Tag     = 0;
            if (0 == currLinkToPageId)
            {
                defaultItem.IsSelected = true;
            }
            comboBoxLinkToPageId.Items.Add(defaultItem);

            ComboBoxItem firstItem = new ComboBoxItem();

            firstItem.Content = firstDPage.name;
            firstItem.Tag     = firstDPage.id;
            if (firstDPage.id == currLinkToPageId)
            {
                firstItem.IsSelected = true;
            }
            comboBoxLinkToPageId.Items.Add(firstItem);

            int lv = 0;

            this.getTreeViewItemChildren(comboBoxLinkToPageId, firstItem, lv, currLinkToPageId);
        }
        /*
         * 单击页面树,显示当前页面内容
         */
        private void TreeView_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            if (e.Source.GetType().Name != "TreeViewItem")
            {
                e.Handled = true;
                return;
            }

            try
            {
                TreeViewItem treeViewItem = (TreeViewItem)e.Source;
                Object       tag          = treeViewItem.Tag;
                if (tag != null)
                {
                    Int32 pageId      = Int32.Parse(tag.ToString());
                    DPage dPage       = dPageBll.get(pageId);
                    int   frameWidth  = App.localStorage.cfg.screenWidth;
                    int   frameHeight = App.localStorage.cfg.screenHeight;
                    if (dPage.width > 0)
                    {
                        frameWidth = dPage.width;
                    }
                    if (dPage.height > 0)
                    {
                        frameHeight = dPage.height;
                    }
                    mainWindow.mainFrame.Width  = frameWidth;
                    mainWindow.mainFrame.Height = frameHeight;
                    mainWindow.mainFrame.UpdateLayout();
                    mainWindow.changeMainFramePercent(App.localStorage.cfg.pagePercent);

                    PageTemplate page = new PageTemplate(mainWindow.mainFrame, pageId, mainWindow.mqServer);
                    App.localStorage.currPageId = pageId;
                    mainWindow.pageTemplate.NavigationService.Navigate(page);
                    mainWindow.pageTemplate = page;
                }
                else
                {
                    MessageBox.Show("没有tag:" + treeViewItem.Header.ToString());
                }
            }
            catch (ArgumentNullException)
            {
                MessageBox.Show("页面不能为空");
            }
            catch (ArgumentException)
            {
                MessageBox.Show("页面地址异常");
            }
            catch (UriFormatException)
            {
                MessageBox.Show("页面地址格式化异常");
            }
            catch (Exception e4)
            {
                MessageBox.Show("找不到此页面" + e4.Message.ToString() + e4.StackTrace);
            }
        }
예제 #10
0
        /*
         * 新建页面 - 在当前页面之后
         */
        public DPage insertAfter(DPage dPage)
        {
            //补充createTime两个参数
            dPage.createTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

            int rows = dPageDal.updateAfterIdx(dPage);

            return(dPageDal.insert(dPage));
        }
예제 #11
0
 public EditCFrameWindow(Frame mainFrame, DPage dPage, FrameworkElement currElement)
 {
     InitializeComponent();
     WindowStartupLocation = WindowStartupLocation.CenterScreen;
     this.mainFrame        = mainFrame;
     this.currElement      = currElement;
     currDControl          = (DControl)currElement.Tag;
     initCombox(currDControl.pageId, currDControl.linkToPageId);
 }
        /*
         * 获取要删除的页面信息
         */
        private void getPageNameForDelete()
        {
            DPage dPage = dPageBll.get(pageId);

            if (dPage != null)
            {
                pageName.Content = dPage.name;
            }
        }
        /*
         * 初始化页面控件
         */
        private void initControl(Int32 pageId)
        {
            DPage dPage = dPageBll.get(pageId);

            this.dPage = dPage;
            if (dPage == null)
            {
                return;
            }
            //1加载背景图片
            StorageImage storageImage = null;

            if (dPage.backgroundImageId > 0)
            {
                storageImage = storageImageBll.get(dPage.backgroundImageId);
            }
            if (FileUtil.imageIsExists(storageImage?.url))
            {
                Background = Brushes.Transparent;
                FileUtil.readImage2Page(this, AppDomain.CurrentDomain.BaseDirectory + storageImage.url, Convert.ToInt32(ActualWidth), Stretch.Fill);
            }
            else if (showDefaultBackgroundInCFrameDialog)
            {
                Background = Brushes.Transparent;
                FileUtil.readImage2Page(this, AppDomain.CurrentDomain.BaseDirectory + Params.CFrameDialogDefaultBackground, Convert.ToInt32(ActualWidth), Stretch.Fill);
            }
            //2加载视频背景
            if (dPage.backgroundVideoId > 0)
            {
                StorageVideo storageVideo = storageVideoBll.get(dPage.backgroundVideoId);
                if (storageVideo != null)
                {
                    int pageWidth  = App.localStorage.cfg.screenWidth;
                    int pageHeight = App.localStorage.cfg.screenHeight;
                    if (dPage.width > 0)
                    {
                        pageWidth  = dPage.width;
                        pageHeight = dPage.height;
                    }
                    insertCVideoBackground(storageVideo, pageWidth, pageHeight);
                }
            }


            insertToPage = new InsertToPage(mainFrame, container, dPage, this);
            List <DControl> list = dControlBll.getByPageId(pageId);

            if (list == null)
            {
                return;
            }
            foreach (DControl ctl in list)
            {
                insertToPage.insertControl(ctl);
            }
        }
        public EditCVideoBackgroundWindow(PageTemplate pageTemplate, DPage dPage, Editing editing)
        {
            InitializeComponent();
            WindowStartupLocation = WindowStartupLocation.CenterScreen;

            currDPage         = dPage;
            this.pageTemplate = pageTemplate;
            this.editing      = editing;

            init(currDPage.backgroundVideoId);
        }
        //页面居中显示到最前面
        public RenameWindow(TreeView pageTreeColumn, Int32 thatPageId)
        {
            InitializeComponent();
            this.pageTreeColumn = pageTreeColumn;
            this.thatPageId     = thatPageId;

            DPage thatPage = dPageBll.get(this.thatPageId);

            pagename.Text         = thatPage.name;
            WindowStartupLocation = WindowStartupLocation.CenterScreen;
        }
예제 #16
0
        public DResults <TEntity> PageList(IOrderedQueryable <TEntity> ordered, DPage page)
        {
            if (ordered == null)
            {
                return(DResult.Errors <TEntity>("数据查询异常!"));
            }
            var result = ordered.Skip(page.Page * page.Size).Take(page.Size).ToList();
            var total  = ordered.Count();

            return(DResult.Succ(result, total));
        }
 public CAudio(DControl currDControl, DPage dPage, Cfg appCfg, string audioUrl, string audioCoverUrl, MqServer mqServer)
 {
     this.currDControl  = currDControl;
     this.mqServer      = mqServer;
     this.audioUrl      = audioUrl;
     this.audioCoverUrl = audioCoverUrl;
     InitializeComponent();
     mqServer.sendMsgEvent += Client_ReceiveMsgEvent;
     loadPageData();
     Unloaded += this_Unloaded;
 }
예제 #18
0
        /*
         * 获取最后一个页面
         */
        public DPage getLastPage()
        {
            String sql = "select * from dPage order by id desc limit 0,1";

            SQLiteParameter[] parameters =
            {
            };
            DataTable dt = Common.SQLiteHelper.ExecuteQuery(sql, parameters);

            DPage entity = DataToEntity <DPage> .FillModel(dt.Rows[0]);

            return(entity);
        }
예제 #19
0
        //页面居中显示到最前面
        public NewAfterPageWindow(TreeView pageTreeColumn, Int32 thatPageId)
        {
            InitializeComponent();
            this.pageTreeColumn = pageTreeColumn;
            this.thatPageId     = thatPageId;


            DPage lastPage  = dPageBll.getLastPage();
            Int32 maxPageId = lastPage.id + 1;

            pagename.Text         = "新页面" + maxPageId;
            WindowStartupLocation = WindowStartupLocation.CenterScreen;
        }
        public EditBackgroundImageWindow(PageTemplate pageTemplate, DPage dPage, Editing editing)
        {
            InitializeComponent();
            WindowStartupLocation = WindowStartupLocation.CenterScreen;
            this.editing          = editing;
            currDPage             = dPage;
            // this.mainContainer = mainContainer;
            this.pageTemplate = pageTemplate;

            Int32 backgroundImageIdVal = currDPage.backgroundImageId;

            loadPageData(backgroundImageIdVal);
        }
        /*
         * 粘贴一个控件及其子控件 到数据库
         */
        public DControl pasteDControl(DControl dControl, DControl newDControl, DPage dPage)
        {
            //3、插入控件数据库
            newDControl = insertFromPaste(newDControl);
            if (dControl.type == "TurnPicture" || dControl.type == "Marque" || dControl.type == "MarqueLayer")
            {
                turnPictureImagesBll.copyFromDControlId(dControl.id, newDControl.id);
            }
            dControlAnimationBll.copyFromDControlId(dControl.id, newDControl.id);



            return(newDControl);
        }
        /*
         * 初始化页面控件
         */
        private void initControl(Int32 pageId)
        {
            container.Children.Clear();
            dPage = dPageBll.get(pageId);
            if (dPage == null)
            {
                return;
            }
            //1加载背景图片
            StorageImage storageImage = null;

            if (dPage.backgroundImageId > 0)
            {
                storageImage = storageImageBll.get(dPage.backgroundImageId);
            }
            if (FileUtil.imageIsExists(storageImage?.url))
            {
                Background = Brushes.Transparent;
                FileUtil.readImage2Page(this, AppDomain.CurrentDomain.BaseDirectory + storageImage.url, App.localStorage.cfg.screenWidth, Stretch.Fill);
            }
            else if (showDefaultBackgroundInCFrameDialog)
            {
                Background = Brushes.Transparent;
                FileUtil.readImage2Page(this, AppDomain.CurrentDomain.BaseDirectory + Params.CFrameDialogDefaultBackground, App.localStorage.cfg.screenWidth, Stretch.Fill);
            }
            else
            {
                Background = Brushes.White;
            }

            //2加载视频背景
            if (dPage.backgroundVideoId > 0)
            {
                StorageVideo storageVideo = storageVideoBll.get(dPage.backgroundVideoId);
                if (storageVideo != null)
                {
                    int pageWidth  = App.localStorage.cfg.screenWidth;
                    int pageHeight = App.localStorage.cfg.screenHeight;
                    if (dPage.width > 0)
                    {
                        pageWidth  = dPage.width;
                        pageHeight = dPage.height;
                    }
                    insertCVideoBackground(storageVideo, pageWidth, pageHeight);
                }
            }

            //编辑框,及页面空白处点击
            editing = new Editing(mainFrame, this);
        }
        //页面居中显示到最前面
        public NewPageWindow(TreeView pageTreeColumn, Int32 parentId)
        {
            InitializeComponent();
            WindowStartupLocation = WindowStartupLocation.CenterScreen;
            this.pageTreeColumn   = pageTreeColumn;
            this.parentId         = parentId;

            DPage lastPage  = dPageBll.getLastPage();
            Int32 maxPageId = lastPage.id + 1;

            pagename.Text = "新页面" + maxPageId;

            initCombox(App.localStorage.cfg.pageSwitchType);
        }
예제 #24
0
        /*
         * 向下移动
         */
        public void moveDown(int currPageId, int nextPageId)
        {
            DPage currDPage = dPageDal.get(currPageId);
            DPage nextDPage = dPageDal.get(nextPageId);

            int currIdx = currDPage.idx;
            int nextIdx = nextDPage.idx;

            currDPage.idx = nextIdx;
            nextDPage.idx = currIdx;

            dPageDal.update(currDPage);
            dPageDal.update(nextDPage);
        }
예제 #25
0
        /*
         * 向上移动
         */
        public void moveUp(int currPageId, int prevPageId)
        {
            DPage currDPage = dPageDal.get(currPageId);
            DPage prevDPage = dPageDal.get(prevPageId);

            int currIdx = currDPage.idx;
            int prevIdx = prevDPage.idx;

            currDPage.idx = prevIdx;
            prevDPage.idx = currIdx;

            dPageDal.update(currDPage);
            dPageDal.update(prevDPage);
        }
        /*
         * 获取页面的宽度
         *
         * pageWidth=0,则返回触摸屏的宽度
         */
        public static Cfg getPageCfg(DPage dPage, Cfg appCfg)
        {
            Cfg result = new Cfg();

            result.screenWidth  = dPage.width;
            result.screenHeight = dPage.height;

            if (result.screenWidth <= 0 || result.screenHeight <= 0)
            {
                result.screenWidth  = appCfg.screenWidth;
                result.screenHeight = appCfg.screenHeight;
            }
            return(result);
        }
예제 #27
0
        private void Submit_Button_Click(object sender, RoutedEventArgs e)
        {
            ComboBoxItem item        = (ComboBoxItem)linkToPageId.SelectedItem;
            int          selectedVal = 0;

            if (item != null)
            {
                selectedVal = (int)item.Tag;
            }
            DPage dPage = dPageBll.get(selectedVal);

            if (dPage == null)
            {
                MessageBox.Show("页面不存在");
                return;
            }

            Boolean result = dControlBll.isNestedOfCurrPageId(dPage.id, currDControl.pageId);

            if (result)
            {
                MessageBox.Show("选择的页面中,嵌套了当前页面,不可用");
                return;
            }



            //更新到数据库
            DControl dControl = dControlBll.get(currDControl.id);

            dControl.linkToPageId = selectedVal;
            currElement.Tag       = dControl;
            dControlBll.update(dControl);

            CFrame cFrame = (CFrame)currElement;

            //DPage dPage1 = dPageBll.get(dControl.linkToPageId);
            ////  if (dPage1 == null) return;
            //int frameWidth = App.localStorage.cfg.screenWidth;
            //int frameHeight = App.localStorage.cfg.screenHeight;
            //if (dPage1 != null && dPage1.width > 0) frameWidth = dPage1.width;
            //if (dPage1 != null && dPage1.height > 0) frameHeight = dPage1.height;
            //PageTemplate pageTemplate = new PageTemplate(mainFrame, dControl.linkToPageId);

            cFrame.updateElement(dControl, App.localStorage.cfg);

            Close();
        }
 /*
  * 将新添加的页面加入到页面树中
  */
 private void updateToTree(ItemsControl tree, DPage dPage)
 {
     foreach (TreeViewItem item in tree.Items)
     {
         Int32 pageId = (Int32)item.Tag;
         if (thatPageId == pageId)
         {
             item.Header = dPage.name;
             break;
         }
         else
         {
             updateToTree(item, dPage);
         }
     }
 }
예제 #29
0
        /*
         * 获取最大排序的那个页面
         */
        public DPage getMaxIdxByParentId(Int32 parentId)
        {
            String sql = "select max(idx) as idx from dPage where parentId=@parentId";

            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@parentId", DbType.Int32, 4)
            };
            parameters[0].Value = parentId;

            DataTable dt = Common.SQLiteHelper.ExecuteQuery(sql, parameters);

            DPage entity = DataToEntity <DPage> .FillModel(dt.Rows[0]);

            return(entity);
        }
        public CCalendar(DControl ctl, DPage dPage, Cfg cfg)
        {
            weekDayArr[0] = cfg.week7;
            weekDayArr[1] = cfg.week1;
            weekDayArr[2] = cfg.week2;
            weekDayArr[3] = cfg.week3;
            weekDayArr[4] = cfg.week4;
            weekDayArr[5] = cfg.week5;
            weekDayArr[6] = cfg.week6;

            InitializeComponent();
            currDControl = ctl;
            init();
            Unloaded    += CCalendar_Unloaded;
            SizeChanged += CCalendar_SizeChanged;
        }