Beispiel #1
0
        internal Page(Chapter a_chapter, string url, int index, ulong id, string name, byte[] hash, 
            string imageFilePath, PageState pageState) : base(id)
        {
            Hash = hash;
            ImageFilePath = imageFilePath;
            _pageState = pageState;

            Chapter = a_chapter;
            URL = HtmlDecode(url);
            Index = index;

            if (State == PageState.Downloading)
                _pageState = PageState.Initial;
            if (State == PageState.Waiting)
                _pageState = PageState.Initial;

            if (name != "")
            {
                name = name.Trim();
                name = name.Replace("\t", " ");
                while (name.IndexOf("  ") != -1)
                    name = name.Replace("  ", " ");
                name = HtmlDecode(name);
                Name = FileUtils.RemoveInvalidFileCharacters(name);
            }
            else
                Name = Index.ToString();
        }
Beispiel #2
0
        internal Page(Chapter a_chapter, string a_url, int a_index, ulong a_id, string a_name, byte[] a_hash, 
            string a_image_file_path, PageState a_state) : base(a_id)
        {
            Hash = a_hash;
            ImageFilePath = a_image_file_path;
            m_state = a_state;

            Chapter = a_chapter;
            URL = HtmlDecode(a_url);
            Index = a_index;

            if (State == PageState.Downloading)
                m_state = PageState.Initial;
            if (State == PageState.Waiting)
                m_state = PageState.Initial;

            if (a_name != "")
            {
                a_name = a_name.Trim();
                a_name = a_name.Replace("\t", " ");
                while (a_name.IndexOf("  ") != -1)
                    a_name = a_name.Replace("  ", " ");
                a_name = HtmlDecode(a_name);
                Name = FileUtils.RemoveInvalidFileCharacters(a_name);
            }
            else
                Name = Index.ToString();
        }
    /// <summary>
    /// Переход в режим создания нового пользователя.
    /// </summary>
    protected void createNewUser(object sender, EventArgs e)
    {
        State = PageState.Creating;

        userInfo.UserID = null;
        userGrid.SelectedIndex = -1;
    }
 internal EwfPageRequestState( PageState pageState, string scrollPositionX, string scrollPositionY )
 {
     this.pageState = pageState;
     this.scrollPositionX = scrollPositionX;
     this.scrollPositionY = scrollPositionY;
     TopModificationErrors = new string[ 0 ];
     InLineModificationErrorsByDisplay = new Dictionary<string, IEnumerable<string>>();
 }
Beispiel #5
0
 public BlockState(ushort pageCount)
 {
     PageStates = new PageState[pageCount];
     FreePageCount = pageCount;
     AllcPageCount = 0;
     LivePageCount = 0;
     DeadPageCount = 0;
 }
    //Sets Page Data and adds to PageDataList
    private static void UpdatePageList(PageState _pageState)
    {
        //Create new PageData object and set stuff.
        PageData _pageData = new PageData();
        _pageData.State = _pageState;
        _pageData.ID = (int)_pageState.GetHashCode();//Get ID from enum HashCode 0-4

        //Update dictionary with ChapterState and ChapterData
        PageDataList.Add(_pageData);
    }
Beispiel #7
0
 public static string GetCompressedHash(PageState page)
 {
     var compressed = new State
     {
         PlayerState = page.State.PlayerState.And(page.AffectedState.PlayerState),
         ScenesSeen = page.State.ScenesSeen.And(page.AffectedState.ScenesSeen),
         ActionsToShow = page.State.ActionsToShow,
         ActionFirstToggles = page.State.ActionFirstToggles
     };
     return GetUniqueHash(compressed, page.Scene.Key);
 }
        protected override void UpdateUiState(PageState newState) {
            pageState = newState;

            StartRecording.Visibility = (pageState != PageState.InProgress) ? Visibility.Visible : Visibility.Collapsed;
            StopRecording.Visibility = (pageState == PageState.InProgress) ? Visibility.Visible : Visibility.Collapsed;

            StartRecording.IsEnabled = (pageState == PageState.Ready);
            Setting.IsEnabled = (pageState != PageState.InProgress);
            VideoEffect.IsEnabled = (pageState == PageState.Ready);

            VideoPreview.Visibility = (pageState != PageState.InProgress) ? Visibility.Visible : Visibility.Collapsed;
        }
        private void DoSelect()
        {
            string where = "";
            foreach (CommonSearchCriterionItem item in SearchCriterion.Searches.Searches)
            {
                if (!String.IsNullOrEmpty(item.Value.ToString()))
                {
                    switch (item.PropertyName)
                    {
                    case "BeginDate":
                        where += " and CreateTime>='" + item.Value + "' ";
                        break;

                    case "EndDate":
                        where += " and CreateTime<='" + (item.Value.ToString()).Replace(" 0:00:00", " 23:59:59") + "' ";
                        break;

                    default:
                        where += " and " + item.PropertyName + " like '%" + item.Value + "%' ";
                        break;
                    }
                }
            }
            switch (Index)
            {
            case "0":    //未接收
                sql = @"select * from BJKY_IntegratedManage..IntegratedMessage where ReceiverId='{0}' and State is null
                    and SubmitState='1'" + where;
                break;

            case "1":    //已接收
                sql = @"select * from BJKY_IntegratedManage..IntegratedMessage where ReceiverId='{0}' and State='1'
                    and SubmitState='1'" + where;
                break;

            case "2":    //未发送
                sql = @"select * from BJKY_IntegratedManage..IntegratedMessage where CreateId='{0}' and SubmitState is null" + where;
                break;

            case "3":    //已发送
                sql = @"select * from BJKY_IntegratedManage..IntegratedMessage where CreateId='{0}' and SubmitState='1'" + where;
                break;

            case "4":    //已删除
                sql = @"select * from BJKY_IntegratedManage..IntegratedMessage where ReceiverId='{0}'and State='2' and SubmitState='1'" + where;
                break;
            }
            sql = string.Format(sql, UserInfo.UserID);
            PageState.Add("DataList", GetPageData(sql, SearchCriterion));
        }
Beispiel #10
0
    public static bool GetPageReadOnly(PageState pageState)
    {
        bool readOnly = true;

        if (pageState == PageState.Show)
        {
            readOnly = true;
        }
        else if (pageState == PageState.New || pageState == PageState.Update)
        {
            readOnly = false;
        }
        return(readOnly);
    }
Beispiel #11
0
        string code = String.Empty; // 对象编码

        #endregion

        #region ASP.NET 事件

        protected void Page_Load(object sender, EventArgs e)
        {
            op   = RequestData.Get <string>("op");
            code = RequestData.Get <string>("code");

            SysDataImportTemplate ent = null;

            switch (this.RequestAction)
            {
            case RequestActionEnum.Custom:
                if (RequestActionString == "import")
                {
                    code = FormData.Get <string>("Code");

                    if (!String.IsNullOrEmpty(code))
                    {
                        ent = SysDataImportTemplate.FindFirstByProperties("Code", code);

                        string fileFullName = FormData.Get <string>("DataFileID");
                        if (!String.IsNullOrEmpty(fileFullName))
                        {
                            DataImportService.ImportData(ent.Config, fileFullName);

                            // 导入完成后删除原文件
                            FileService.DeleteFileByFullID(fileFullName);
                        }
                    }
                }
                else if (RequestActionString == "gettmplid")
                {
                    // 下载文件模板时用于获取模板文件id(异步)
                    if (IsAsyncRequest && !String.IsNullOrEmpty(code))
                    {
                        ent = SysDataImportTemplate.FindFirstByProperties("Code", code);

                        // 返回模板文件ID
                        PageState.Add("id", FileService.GetFileIDByFullID(ent.TemplateFileID));
                    }
                }
                break;

            case RequestActionEnum.Default:
                if (!String.IsNullOrEmpty(code))
                {
                    ent = SysDataImportTemplate.FindFirstByProperties("Code", code);
                    this.SetFormData(ent);
                }
                break;
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     id = RequestData.Get <string>("id");
     if (!string.IsNullOrEmpty(id))
     {
         sql = @"select A.IndicatorSecondName,A.MaxScore,A.SortIndex,A.IndicatorFirstId,B.IndicatorFirstName,
                 B.MaxScore as BMaxScore,B.SortIndex as BSortIndex from BJKY_Examine..IndicatorSecond as A 
             left join BJKY_Examine..IndicatorFirst as B on A.IndicatorFirstId=B.Id where B.ExamineIndicatorId='{0}' order by BSortIndex,A.SortIndex asc";
         sql = string.Format(sql, id);
         PageState.Add("DataList", DataHelper.QueryDictList(sql));
         ExamineIndicator eiEnt = ExamineIndicator.Find(id);
         PageState.Add("BaseInfo", eiEnt.IndicatorName + "-->" + eiEnt.BeRoleName);
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            PersonFirstIndicator ent = null;

            CustomIndicatorId = RequestData.Get <string>("CustomIndicatorId");
            switch (RequestActionString)
            {
            case "delete":
                IList <string> ids = RequestData.GetList <string>("ids");
                foreach (string str in ids)
                {
                    ent = PersonFirstIndicator.Find(str);
                    IList <PersonSecondIndicator> psiEnts = PersonSecondIndicator.FindAllByProperty(PersonSecondIndicator.Prop_PersonFirstIndicatorId, str);
                    foreach (PersonSecondIndicator psiEnt in psiEnts)
                    {
                        psiEnt.DoDelete();
                    }
                    ent.DoDelete();
                }
                break;

            case "AutoUpdate":
                IList <string> entStrList = RequestData.GetList <string>("data");
                if (entStrList.Count > 0)
                {
                    ents = entStrList.Select(tent => JsonHelper.GetObject <PersonFirstIndicator>(tent) as PersonFirstIndicator).ToList();
                }
                if (ents.Count > 0)
                {
                    ents[0].DoUpdate();
                }
                break;

            case "create":
                PersonFirstIndicator pfiEnt = new PersonFirstIndicator();
                CustomIndicator      ciEnt  = CustomIndicator.Find(CustomIndicatorId);
                string sql = @"select max(SortIndex) from BJKY_Examine..PersonFirstIndicator where CustomIndicatorId='" + CustomIndicatorId + "'";
                pfiEnt.SortIndex         = DataHelper.QueryValue <int>(sql) + 1;
                pfiEnt.CustomIndicatorId = ciEnt.Id;
                pfiEnt.TotalWeight       = ciEnt.Weight;
                pfiEnt.DoCreate();
                PageState.Add("Entity", pfiEnt);
                break;

            default:
                DoSelect();
                break;
            }
        }
        /// <summary>
        /// 查询
        /// </summary>
        private void DoSelect()
        {
            string db = ConfigurationManager.AppSettings["ExamineDB"];

            string where = " where 1=1 ";
            string wherec = " where 1=1 ";

            foreach (CommonSearchCriterionItem item in SearchCriterion.Searches.Searches)
            {
                if (item.PropertyName == "Code")
                {
                    if (item.Value + "" != "")
                    {
                        where += " and Id in (select DId from " + db + "..DelieryOrderPart where PCode like '%" + item.Value + "%')";
                    }
                }
                else
                {
                    where += " and " + item.PropertyName + " like '%" + item.Value + "%' ";
                }
            }
            if (RequestData.Get <string>("type") == "yi")
            {
                where  += " and [State]='已出库' ";
                wherec += " and p.[State]='已出库' ";
            }
            else
            {
                where  += " and ([State] is null or [State]<>'已出库') ";
                wherec += " and (p.[State] is null or p.[State]<>'已出库') ";
            }
            string sql = @"select * from " + db + "..DeliveryOrder " + where;

            this.PageState.Add("OrderList", GetPageData(sql, SearchCriterion));

            //查询详细产品的数量
            CommonSearchCriterionItem itemtp = SearchCriterion.Searches.Searches.Where(obj => obj.PropertyName == "Code").FirstOrDefault <CommonSearchCriterionItem>();

            SearchCriterion.Searches.RemoveSearch("Code");
            foreach (CommonSearchCriterionItem search in SearchCriterion.Searches.Searches)
            {
                wherec += " and p." + search.PropertyName + " like '%" + search.Value + "%'";
            }
            if (itemtp != null && itemtp.Value + "" != "")
            {
                wherec += " and c.PCode like '%" + itemtp.Value + "%'";
            }
            PageState.Add("quantity", DataHelper.QueryValue("select sum([Count]) from " + db + "..DeliveryOrder p inner join " + db + "..DelieryOrderPart c on c.DId=p.Id" + wherec));
        }
Beispiel #15
0
        private void DoSelect()
        {
            string where = "";
            foreach (CommonSearchCriterionItem item in SearchCriterion.Searches.Searches)
            {
                if (!string.IsNullOrEmpty(item.Value.ToString()))
                {
                    switch (item.PropertyName)
                    {
                    default:
                        where += " and " + item.PropertyName + " like '%" + item.Value + "%'";
                        break;
                    }
                }
            }
            switch (scoreZone)
            {
            case "95->100":
                sql = @"select * from BJKY_Examine..ExamYearResult where Year='" + year + "' and IntegrationScore>=95" + where;
                break;

            case "90->94":
                sql = @"select * from BJKY_Examine..ExamYearResult where Year='" + year + "' and IntegrationScore>=90 and IntegrationScore < 95" + where;
                break;

            case "85->89":
                sql = @"select * from BJKY_Examine..ExamYearResult where Year='" + year + "' and IntegrationScore>=85 and IntegrationScore < 90" + where;
                break;

            case "80->84":
                sql = @"select * from BJKY_Examine..ExamYearResult where Year='" + year + "' and IntegrationScore>=80 and IntegrationScore < 85" + where;
                break;

            case "75->79":
                sql = @"select * from BJKY_Examine..ExamYearResult where Year='" + year + "' and IntegrationScore>=75 and IntegrationScore < 80" + where;
                break;

            case "70->74":
                sql = @"select * from BJKY_Examine..ExamYearResult where Year='" + year + "' and IntegrationScore>=70 and IntegrationScore < 75" + where;
                break;

            case "0->69":
                sql = @"select * from BJKY_Examine..ExamYearResult where Year='" + year + "' and IntegrationScore>=0 and IntegrationScore < 70" + where;
                break;
            }
            IList <EasyDictionary> dics = DataHelper.QueryDictList(sql);

            PageState.Add("DataList", GetPageData(sql, SearchCriterion));
        }
        private void DoSelect()
        {
            string where = "";
            foreach (CommonSearchCriterionItem item in SearchCriterion.Searches.Searches)
            {
                if (!string.IsNullOrEmpty(item.Value.ToString()))
                {
                    switch (item.PropertyName)
                    {
                    case "StartTime":
                        where += " and StartTime>='" + item.Value + "' ";
                        break;

                    case "EndTime":
                        where += " and EndTime<='" + (item.Value.ToString()).Replace(" 0:00:00", " 23:59:59") + "' ";
                        break;

                    default:
                        where += " and " + item.PropertyName + " like '%" + item.Value + "%'";
                        break;
                    }
                }
            }
            sql = @"select  Id,GroupName  from BJKY_Examine..PersonConfig 
                  where (ClerkIds like '%{0}%' or SecondLeaderIds like '%{0}%' or FirstLeaderIds like '%{0}%') and (GroupType='职能服务部门' or GroupType='经营目标单位')";
            //            sql = @"select * from sysgroup where (parentid='4b54389a-6537-4748-823c-fb55223afbad' or parentid='bde12833-038a-4ec6-bfc9-41f630c70380'
            //            or parentid='3273c49a-1f9b-4328-b54c-d01e39c39edc' or parentid='037f85a8-3777-4015-9bc2-dc5aba4ccb28') and GroupID in
            //            (select GroupID from SysUserGroup where UserID='{0}')";
            sql = string.Format(sql, UserInfo.UserID);
            IList <EasyDictionary> tempDics = DataHelper.QueryDictList(sql);

            if (tempDics.Count > 0)
            {
                if (tempDics[0].Get <string>("GroupName").IndexOf("人力资源") >= 0)
                {
                    PageState.Add("Remove", "F");
                }
                else
                {
                    PageState.Add("Remove", "T");
                }
            }
            sql = @"select * ,(select Count(Id) from BJKY_Examine..ExamineTask  where State!='1' and State!='0' and State!='4'
            and ExamineStageId=ExamineStage.Id) as SubmitQuan from BJKY_Examine..ExamineStage where LaunchDeptId in 
            (select Id from BJKY_Examine..PersonConfig 
             where (ClerkIds like '%{0}%' or SecondLeaderIds like '%{0}%' or FirstLeaderIds like '%{0}%') and (GroupType='职能服务部门' or GroupType='经营目标单位'))" + where;
            sql = string.Format(sql, UserInfo.UserID);
            PageState.Add("DataList", GetPageData(sql, SearchCriterion));
        }
Beispiel #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            switch (RequestActionString)
            {
            case "JudgeSkinIsExist":
                skinNo = RequestData.Get <string>("SkinNo");
                if (!string.IsNullOrEmpty(skinNo))
                {
                    IList <Skin> skinEnts = Skin.FindAll("from Skin where SkinNo='" + skinNo + "'");
                    if (skinEnts.Count > 0)
                    {
                        PageState.Add("SkinIsExist", true);
                    }
                }
                break;

            case "batchsave":
                IList <string> entStrList = RequestData.GetList <string>("data");
                if (entStrList != null && entStrList.Count > 0)
                {
                    IList <Skin> skinEnts = entStrList.Select(tent => JsonHelper.GetObject <Skin>(tent) as Skin).ToList();
                    foreach (Skin ent in skinEnts)
                    {
                        if (ent != null)
                        {
                            Skin sent = ent;
                            sent.SkinNo = sent.SkinNo.ToUpper();    //将包装编号中的字母转换成大写
                            if (String.IsNullOrEmpty(sent.Id))
                            {
                                sent.CreateId   = UserInfo.UserID;
                                sent.CreateName = UserInfo.Name;
                                sent.CreateTime = System.DateTime.Now;
                            }
                            else
                            {
                                sent = DataHelper.MergeData(Skin.Find(sent.Id), sent);
                            }
                            sent.DoSave();
                            // PageState.Add("SkinId", sent.Id);
                        }
                    }
                }
                break;

            default:
                DoSelect();
                break;
            }
        }
Beispiel #18
0
    public override void Enter()
    {
        if (CurrentPage == this)
        {
            return;
        }

        if (CurrentPage != null)
        {
            CurrentPage.Exit();
        }

        CurrentPage = this;
        base.Enter();
    }
Beispiel #19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string purchaseOrderId = RequestData.Get <string>("PurchaseOrderId");

            if (!string.IsNullOrEmpty(purchaseOrderId))
            {
                string sql = @"select A.*,B.ProductType from SHHG_AimExamine..PurchaseOrderDetail as A 
                left join SHHG_AimExamine..PurchaseOrder  as B on A.PurchaseOrderId=B.Id where B.Id='{0}'";
                sql = string.Format(sql, purchaseOrderId);
                IList <EasyDictionary> dics = DataHelper.QueryDictList(sql);
                PageState.Add("DetailList", dics);
                PurchaseOrder poEnt = PurchaseOrder.Find(purchaseOrderId);
                PageState.Add("PurchaseOrder", poEnt);
            }
        }
Beispiel #20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string qryString = "SELECT nt.*, nt.TypeName AS title, ISNULL(n.[Count], 0) AS count FROM NewsType nt LEFT JOIN "
                               + "(SELECT TypeId, COUNT(Id) AS [Count] FROM News WHERE ReceiveUserId LIKE '%" + UserInfo.UserID + "%' GROUP BY TypeId) AS n "
                               + " ON n.TypeId = nt.Id AND AllowQueryId LIKE '%" + UserInfo.UserID + "%'";

            DataTable dtNews = Aim.Data.DataHelper.QueryDataTable(qryString);

            PageState.Add("News", JsonHelper.GetJsonStringFromDataTable(dtNews));

            int msgCount = Aim.Data.DataHelper.QueryValue <int>("SELECT COUNT(Id) AS count FROM SysMessage WHERE ReceiverName LIKE '%" + UserInfo.UserID + "%'");

            PageState.Add("MsgCount", msgCount);
            GetUserCreateMoudles();
        }
Beispiel #21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string where = "";
            foreach (CommonSearchCriterionItem item in SearchCriterion.Searches.Searches)
            {
                if (item.Value.ToString() != "")
                {
                    where += " and A." + item.PropertyName + " like '%" + item.Value + "%'";
                }
            }
            string sql = @"select Id,GroupName,CreateTime,GroupType,FirstLeaderNames from BJKY_Examine..PersonConfig where 
            GroupType='职能服务部门' or GroupType='经营目标单位' " + where;

            PageState.Add("DataList", GetPageData(sql, SearchCriterion));
        }
Beispiel #22
0
        protected async override Task ChangePageState(PageState state, string message = null)
        {
            if (state.Equals(PageState.LOADING))
            {
                ListLayout.IsVisible       = false;
                LoadingIndicator.IsVisible = true;
            }
            else if (this.state.Equals(PageState.LOADING))
            {
                ListLayout.IsVisible       = true;
                LoadingIndicator.IsVisible = false;
            }

            this.state = state;
        }
        private void DoSelect()
        {
            string where = "";
            foreach (CommonSearchCriterionItem item in SearchCriterion.Searches.Searches)
            {
                if (!string.IsNullOrEmpty(item.Value.ToString()))
                {
                    where += " and " + item.PropertyName + " like '%" + item.Value + "%'";
                }
            }
            string sql = @"select A.*,B.Pcn  from SHHG_AimExamine..CombineSplit as A 
            left join SHHG_AimExamine..Products as B on A.ProductId=B.Id  where 1=1" + where;

            PageState.Add("DataList", GetPageData(sql, SearchCriterion));
        }
Beispiel #24
0
 public void Update(Vector3f cam)
 {
     if (this.pageState == PageState.UNLOADING)
     {
         if (this.cacheTime > maxCacheTime)
         {
             this.pageState = PageState.UNLOADED;
             cacheTime      = 0f;
         }
         else
         {
             cacheTime += 0.2f;
         }
     }
 }
Beispiel #25
0
        private void DoSelect()
        {
            string where = "";
            foreach (CommonSearchCriterionItem item in SearchCriterion.Searches.Searches)
            {
                where += " and " + item.PropertyName + " like '%" + item.Value + "%'";
            }
            string warehouseId = RequestData.Get <string>("WarehouseId");
            string sql         = @"select A.*,B.Isbn as ProductIsbn,B.Pcn as ProductPcn,B.ProductType  from SHHG_AimExamine..StockInfo as A 
            left join SHHG_AimExamine..Products as B on A.ProductId=B.Id
            where A.WarehouseId='{0}' " + where;

            sql = string.Format(sql, warehouseId);
            PageState.Add("DataList", GetPageData(sql, SearchCriterion));
        }
Beispiel #26
0
        /// <summary>
        /// Remove code with specified codeId. Uses pageStateJson for simplicity
        /// </summary>
        public IActionResult Remove(int codeId, string pageStateJson)
        {
            PageState pageState = JsonConvert.DeserializeObject <PageState>(pageStateJson);
            var       result    = codeManager.Remove(codeId);

            if (!result.Success)
            {
                TempData["ErrorMessage"] = result.Details;
                return(Redirect(Url.Action("Codes", pageState)));
            }
            else
            {
                return(Redirect(Url.Action("Codes", pageState)));
            }
        }
Beispiel #27
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;

            currentPage = 1;
        }
        else
        {
            Destroy(gameObject);
        }

        DontDestroyOnLoad(gameObject);
    }
Beispiel #28
0
 private void DoSelect()
 {
     if (according == "Sender")
     {
         sql = @"select newid() as Id, CreateId,CreateName,Count(Id) as Quantity from BJKY_SP..IntegratedMessage 
          where ReceiverId='{0}' and State is null group by CreateId,CreateName";
     }
     else
     {
         sql = @"select newid() as Id, MessageType,Count(Id) as Quantity from BJKY_SP..IntegratedMessage 
         where ReceiverId='{0}' and State is null group by MessageType ";
     }
     sql = string.Format(sql, UserInfo.UserID);
     PageState.Add("DataList", DataHelper.QueryDictList(sql));
 }
Beispiel #29
0
        protected override void UpdateUiState(PageState newState)
        {
            pageState = newState;

            Setting.IsEnabled   = (pageState != PageState.InProgress);
            Transcode.IsEnabled = (pageState != PageState.InProgress);

            ProgressParent.Visibility = (pageState != PageState.InProgress) ? Windows.UI.Xaml.Visibility.Collapsed : Windows.UI.Xaml.Visibility.Visible;

            Preview.IsEnabled = (pageState != PageState.InProgress);
            Preview.ShowControls(Preview.IsEnabled);

            Preview2.IsEnabled = (pageState != PageState.InProgress);
            Preview2.ShowControls(Preview2.IsEnabled);
        }
Beispiel #30
0
 private void DoSelect()
 {
     if (op != "c" && op != "cs")
     {
         ent = Vedio.Find(id);
         SetFormData(ent);
         sql = @"select * from FileItem where Id='{0}'";
         sql = string.Format(sql, ent.VedioFile);
         PageState.Add("DataList", DataHelper.QueryDictList(sql));
         sql = @"select * from FileItem where PatIndex('%'+Id+'%','{0}')>0";
         sql = string.Format(sql, ent.ImageFile);
         PageState.Add("ImageList", DataHelper.QueryDictList(sql));
     }
     PageState.Add("VedioType", SysEnumeration.GetEnumDict("VedioType"));
 }
        public void StartFlow()
        {
            ArrayList array   = new ArrayList();
            string    formUrl = "/Task/A_TaskWBSEdit.aspx?op=r&InFlow=T&id=" + id;
            Guid      guid    = WorkFlow.StartWorkFlow(id, formUrl, "任务审批", "AimFinishAudit", UserInfo.UserID, UserInfo.Name);
            A_TaskWBS ptEnt   = A_TaskWBS.TryFind(twEnt.ParentID); //获取到上级任务责任人

            if (ptEnt != null)
            {
                array.Add(guid + "#" + ptEnt.DutyId + "$" + ptEnt.DutyName);
                PageState.Add("WorkFlowInfo", array);
                twEnt.State = "1.5";
                twEnt.Update();
            }
        }
Beispiel #32
0
 protected void Page_Load(object sender, EventArgs e)
 {
     id    = RequestData.Get <string>("id", String.Empty);
     type  = RequestData.Get <string>("type", String.Empty).ToLower();
     ctype = RequestData.Get <string>("ctype", "user").ToLower();
     if (ctype == "group")
     {
         if (!String.IsNullOrEmpty(id))
         {
             ICriterion cirt = null;
             if (type == "gtype")
             {
                 cirt = Expression.Sql("UserID IN (SELECT UserID FROM SysUserGroup WHERE GroupID IN (SELECT GroupID FROM SysGroup WHERE Type = ?))", id, NHibernateUtil.String);
             }
             else
             {
                 // 应该同时获取子组用户
                 cirt = Expression.Sql("UserID IN (SELECT UserID FROM View_SysUserGroup WHERE Path LIKE '%" + id + "%')",
                                       id, NHibernateUtil.String);
             }
             cirt = SearchHelper.IntersectCriterions(cirt, Expression.IsNull("Ext1"));
             SearchCriterion.AutoOrder = false;
             SearchCriterion.SetOrder(SysUser.Prop_WorkNo);
             users = SysUserRule.FindAll(SearchCriterion, cirt);
         }
         this.PageState.Add("UsrList", users);
     }
     else
     {
         SearchCriterion.AutoOrder = false;
         string dName  = SearchCriterion.GetSearchValue <string>("Name");
         string workNo = SearchCriterion.GetSearchValue <string>("WorkNo");
         SearchCriterion.SetOrder(SysUser.Prop_WorkNo);
         if (dName != null && dName.Trim() != "")
         {
             string where = "select * from SysUser where " + GetPinyinWhereString("Name", dName);
             where       += "and Ext1 is null and WorkNo like '%" + workNo + "%'";
             this.PageState.Add("UsrList", DataHelper.QueryDictList(where));
         }
         else
         {
             ICriterion cirt = null;
             cirt  = SearchHelper.IntersectCriterions(cirt, Expression.IsNull("Ext1"));
             users = SysUserRule.FindAll(SearchCriterion, cirt);
             PageState.Add("UsrList", users);
         }
     }
 }
Beispiel #33
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //根据参数设置缩略图片大小
            if (!string.IsNullOrEmpty(this.RequestData.Get <string>("ImgDirectory")))
            {
                string imgSize = this.RequestData.Get("ImgDirectory").ToString();
                if (imgSize.Split('*').Length > 1)
                {
                    ImgDirectory = imgSize;
                }
            }

            op = RequestData.Get <string>("op");
            id = RequestData.Get <string>("id");
            if (!string.IsNullOrEmpty(id))
            {
                ent = Vedio.Find(id);
            }
            switch (RequestActionString)
            {
            case "update":
                ent = GetMergedData <Vedio>();
                ent.DoUpdate();
                break;

            case "ImportFile":
                string fileIds  = RequestData.Get <string>("fileIds");
                string fileType = Server.UrlDecode(RequestData.Get <string>("FileType"));
                if (!string.IsNullOrEmpty(fileIds))
                {
                    sql = @"select * from BJKY_Portal..FileItem where PatIndex('%'+Id+'%','{0}')>0";
                    sql = string.Format(sql, fileIds);
                    PageState.Add("Result", DataHelper.QueryDictList(sql));
                }
                break;

            case "create":
                ent           = GetPostedData <Vedio>();
                ent.PlayTimes = 0;
                ent.DoCreate();
                VideoToThumbImg(ent);
                break;

            default:
                DoSelect();
                break;
            }
        }
Beispiel #34
0
        private void DoSelect()
        {
            string where = "";
            string productType = RequestData.Get <string>("ProductType");

            if (!string.IsNullOrEmpty(productType))
            {
                SearchCriterion.AddSearch("ProductType", productType);
            }
            foreach (CommonSearchCriterionItem item in SearchCriterion.Searches.Searches)
            {
                if (item.PropertyName == "BeginDate1" && item.Value + "" != "")
                {
                    where += " and B.CreateTime>'" + item.Value + "' ";
                }
                else if (item.PropertyName == "EndDate1" && item.Value + "" != "")
                {
                    where += " and B.CreateTime<'" + (item.Value + "").Replace(" 0:00:00", " 23:59:59") + "' ";
                }
                else if (item.PropertyName == "BeginDate" && item.Value + "" != "")
                {
                    where += " and B.EndDate>'" + item.Value + "' ";
                }
                else if (item.PropertyName == "EndDate" && item.Value + "" != "")
                {
                    where += " and B.EndDate<'" + (item.Value + "").Replace(" 0:00:00", " 23:59:59") + "' ";
                }
                else if (item.Value + "" != "")
                {
                    where += " and " + item.PropertyName + " like '%" + item.Value + "%' ";
                }
            }
            string sql = @"select A.*,B.Number,B.CName,B.Salesman,B.EndDate,B.InvoiceNumber,C.ProductType,C.Pcn,C.CostPrice,
                    SHHG_AimExamine.dbo.fun_CaculateCostAmount(A.PId,A.Count,A.SalePrice) as CostAmount,                                       
                    (select top(1) Rate from SHHG_AimExamine..ExchangeRate where Symbo =(select top(1) Symbo from SHHG_AimExamine..Supplier where Id=C.SupplierId )) as Rate,
                    SHHG_AimExamine.dbo.fun_CaculateBuyPrice(A.PId) as BuyPrice, B.CreateTime
                    from (
                    select OId,PId,PCode,PName,Isbn,sum([count]) as [Count],max(SalePrice) as SalePrice, sum(Amount) as Amount from(
                    select OId,PId,PCode,PName,Isbn,([Count]-isnull(ReturnCount,0)) as Count,SalePrice,Amount from SHHG_AimExamine..OrdersPart                     
                    )t
                    group by PId,PCode,PName,Isbn,OId having sum([Count])>0
                    ) as A
                    left join SHHG_AimExamine..SaleOrders as B on A.OId=B.Id 
                    left join SHHG_AimExamine..Products as C on C.Id=A.PId 
                    where (B.DeliveryState is null or B.DeliveryState<>'已作废') and B.InvoiceType='发票' " + where;

            PageState.Add("OrderList", GetPageData(sql, SearchCriterion));
        }
Beispiel #35
0
        string type = String.Empty; // 对象类型

        #endregion

        #region ASP.NET 事件

        protected void Page_Load(object sender, EventArgs e)
        {
            op = RequestData.Get <string>("op");
            id = RequestData.Get <string>("id") == null?RequestData.Get <string>("Id") : RequestData.Get <string>("id");

            type = RequestData.Get <string>("type");

            WorkflowTemplate ent = null;

            switch (this.RequestAction)
            {
            case RequestActionEnum.Update:
                ent = this.GetMergedData <WorkflowTemplate>();
                ent.DoUpdate();
                this.SetMessage("修改成功!");
                break;

            case RequestActionEnum.Insert:
            case RequestActionEnum.Create:
                ent = this.GetPostedData <WorkflowTemplate>();

                // 设置项目信息
                ent.Creator = UserInfo.Name;
                ent.DoCreate();
                this.SetMessage("新建成功!");
                break;

            case RequestActionEnum.Delete:
                ent = this.GetTargetData <WorkflowTemplate>();
                ent.DoDelete();
                this.SetMessage("删除成功!");
                return;
            }

            if (op != "c" && op != "cs")
            {
                if (!String.IsNullOrEmpty(id))
                {
                    ent = WorkflowTemplate.Find(id);
                }
                this.SetFormData(ent);
            }
            else
            {
                PageState.Add("CreateName", UserInfo.Name);
                PageState.Add("CreateTime", DateTime.Now);
            }
        }
Beispiel #36
0
    void SetPageState(PageState state)
    {
        switch (state)
        {
        case PageState.Initialize:
            buttons.SetActive(false);
            startPage.SetActive(true);
            redCollider.SetActive(false);
            blueCollider.SetActive(false);
            levelOverPage.SetActive(false);
            vacuumRend.sharedMaterial  = m_Material[0];
            theRingRend.sharedMaterial = m_Material[0];
            break;

        case PageState.Started:
            buttons.SetActive(true);
            startPage.SetActive(false);
            redCollider.SetActive(false);
            blueCollider.SetActive(true);
            vacuumRend.sharedMaterial  = m_Material[0];
            theRingRend.sharedMaterial = m_Material[0];
            break;

        case PageState.RedCollider:
            startPage.SetActive(false);
            redCollider.SetActive(true);
            blueCollider.SetActive(false);
            vacuumRend.sharedMaterial  = m_Material[1];
            theRingRend.sharedMaterial = m_Material[1];
            break;

        case PageState.BlueCollider:
            startPage.SetActive(false);
            redCollider.SetActive(false);
            blueCollider.SetActive(true);
            vacuumRend.sharedMaterial  = m_Material[0];
            theRingRend.sharedMaterial = m_Material[0];
            break;

        case PageState.LevelOverPage:
            buttons.SetActive(false);
            startPage.SetActive(false);
            redCollider.SetActive(false);
            blueCollider.SetActive(false);
            levelOverPage.SetActive(true);
            break;
        }
    }
Beispiel #37
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string id = RequestData.Get <string>("id");

            switch (RequestActionString)
            {
            case "Modify":
                PageState.Add("result", AllowOperate(id) == true ? "true" : "false");
                break;

            case "batchdelete":
                IList <object> idList = RequestData.GetList <object>("IdList");
                if (idList != null && idList.Count > 0)
                {
                    foreach (object obj in idList)
                    {
                        bool allowDelete = AllowOperate(obj.ToString());
                        if (allowDelete)
                        {
                            DataHelper.ExecSql("delete SHHG_AimExamine..PurchaseOrder where Id='" + obj.ToString() + "'");
                            PurchaseOrderDetail.DeleteAll("PurchaseOrderId='" + obj + "'");    //删除采购订单详细
                            PageState.Add("Message", "删除成功!");
                        }
                        else
                        {
                            PageState.Add("Message", "已创建入库单或者付款单的订单不允许删除!");
                            return;
                        }
                    }
                }
                break;

            default:
                if (RequestData.Get <string>("optype") == "getChildData")
                {
                    string purchaseOrderId      = RequestData.Get <string>("PurchaseOrderId");
                    string tempsql              = @"select A.*,C.Symbo from SHHG_AimExamine..PurchaseOrderDetail as A left join SHHG_AimExamine..PurchaseOrder as B
                        on A.PurchaseOrderId=B.Id left join SHHG_AimExamine..Supplier as C on B.SupplierId=C.Id where A.PurchaseOrderId='" + purchaseOrderId + "'";
                    IList <EasyDictionary> dics = DataHelper.QueryDictList(tempsql);
                    PageState.Add("DetailList", dics);
                }
                else
                {
                    DoSelect();
                }
                break;
            }
        }
        private void DoSelect()
        {
            if (op != "c" && op != "cs")
            {
                ent = ReleaseDocument.Find(id);
                SetFormData(ent);
                sql = @"select * from Task where PatIndex('%{0}%',EFormName)>0  and Status='4' and ApprovalNodeName in('部门领导','相关部门会签','院办主任','归口部门会签','主管院长','院办主任核稿','院长审批') 
                order by FinishTime asc";
                sql = string.Format(sql, id);
                IList <EasyDictionary> taskDics = DataHelper.QueryDictList(sql);
                PageState.Add("Opinion", taskDics);
                sql = @"select  * from BJKY_Portal..FileItem where PatIndex('%'+Id+'%','{0}')>0 ";
                sql = string.Format(sql, ent.ApproveContent);
                PageState.Add("DataList", DataHelper.QueryDictList(sql));
                sql = @"select  * from BJKY_Portal..FileItem where PatIndex('%'+Id+'%','{0}')>0 ";
                sql = string.Format(sql, ent.Attachment);
                PageState.Add("DataList2", DataHelper.QueryDictList(sql));
            }
            else
            {
                sql = @"select top 1 case [Type] when 3 then ParentDeptName when 2 then ChildDeptName end as DeptName,
                case [Type] when 3 then ParentId when 2 then DeptId end as DeptId
                from View_SysUserGroup where UserId='{0}'";
                sql = string.Format(sql, UserInfo.UserID);
                IList <EasyDictionary> deptDics = DataHelper.QueryDictList(sql);
                if (deptDics.Count > 0)
                {
                    var obj = new
                    {
                        CreateDeptId   = deptDics[0].Get <string>("DeptId"),
                        CreateDeptName = deptDics[0].Get <string>("DeptName"),
                        CreateId       = UserInfo.UserID,
                        CreateName     = UserInfo.Name
                    };
                    SetFormData(obj);
                }
            }
            string taskId = RequestData.Get <string>("TaskId");//取审批暂存时所填写的意见

            if (!string.IsNullOrEmpty(taskId))
            {
                Task tEnt = Task.Find(taskId);
                if (tEnt.Status != 4 && !string.IsNullOrEmpty(tEnt.Description))
                {
                    PageState.Add("UnSubmitOpinion", tEnt.Description);
                }
            }
        }
Beispiel #39
0
    /// <summary>
    /// Сохраниение информации о пользователе.
    /// </summary>
    protected void applyUserInfo(object sender, EventArgs e)
    {
        Person updatedUser = userInfo.SaveUserChanges();
        if (State == PageState.Creating)
            State = PageState.Normal;

        try
        {
            userInfo.UserID = updatedUser.ID;
        }
        catch
        {
            userInfo.UserID = CurrentUser.ID;
        }

        userGrid.GridDataBind();
        //userGrid.SelectedUserID = userInfo.UserID.Value;
    }
Beispiel #40
0
        private PageState GetPageState(BinaryData binaryData)
        {
            if (binaryData == null)
                throw new ArgumentNullException("binaryData");

            PageState resultPageState = null;
            Stream sharedDataBlobStream = binaryData.GetStream();
            int streamLength = Convert.ToInt32(sharedDataBlobStream.Length);
            var byteContent = new byte[streamLength];

            //try
            //{
            sharedDataBlobStream.Read(byteContent, 0, streamLength);
            resultPageState = new PageState(byteContent, PersonalizationScope.Shared);
            //}
            //catch (Exception exc)
            //{
            //    WriteException(exc);
            //}

            return resultPageState;
        }
Beispiel #41
0
    protected void Page_Load(object sender, EventArgs e)
    {
        userGrid.FilterControl = usersFilter;
        userGrid.UserChanging += userInfo.OnUserChanging;

        if (IsPostBack)
            return;

        State = PageState.Normal;
        userInfo.UserID = CurrentUser.ID;
    }
Beispiel #42
0
 private void Categroy_Click(object sender, EventArgs e)
 {
     pageState = PageState.Categroy;
     Categroy.Visibility = Visibility.Visible;
 }
Beispiel #43
0
 // 捕获后退按键
 override protected void OnBackKeyPress(CancelEventArgs e)
 {
     if (pageState == PageState.Image)
     {
         ThreadLayer.Visibility = Visibility.Visible;
         ImageLayer.Visibility = Visibility.Collapsed;
         pageState = PageState.Threads;
         e.Cancel = true;
         ChangeAppBar(PageState.Threads);
     } else if(pageState == PageState.Categroy)
     {
         Categroy.Visibility = Visibility.Collapsed;
         pageState = PageState.Threads;
         e.Cancel = true;
     } else if(pageState == PageState.Threads)
     {
         string cangoback = (string)Browser.InvokeScript("cangoback");
         if (cangoback == "yes")
         {
             Browser.InvokeScript("backup");
             e.Cancel = true;
         }
         else
         {
             MessageBoxResult result = MessageBox.Show("确认退出?", "退出", MessageBoxButton.OKCancel);
             if (result != MessageBoxResult.OK)
             {
                 e.Cancel = true;
             }
         }
     }
 }
Beispiel #44
0
        protected override void UpdateUiState(PageState newState) {
            pageState = newState;

            Setting.IsEnabled = (pageState != PageState.InProgress);
            Transcode.IsEnabled = (pageState != PageState.InProgress);

            ProgressParent.Visibility = (pageState != PageState.InProgress) ? Windows.UI.Xaml.Visibility.Collapsed : Windows.UI.Xaml.Visibility.Visible;

            Preview.IsEnabled = (pageState != PageState.InProgress);
            Preview.ShowControls(Preview.IsEnabled);
        }
Beispiel #45
0
 public void Update(Vector3f cam)
 {
     if (this.pageState == PageState.UNLOADING)
     {
         if (this.cacheTime > maxCacheTime)
         {
             this.pageState = PageState.UNLOADED;
             cacheTime = 0f;
         }
         else
         {
             cacheTime += 0.2f;
         }
     }
 }
Beispiel #46
0
 private IEnumerable<Action> GetActionsForPage(PageState page)
 {
     var actions = new List<Action>();
     for (var i = 0; i < page.State.ActionsToShow.Count; i++)
     {
         if (page.State.ActionsToShow[i]) actions.Add(_actionMatrix[i + 1]);
     }
     return actions;
 }
Beispiel #47
0
 private void TextBlock_Tap(object sender, System.Windows.Input.GestureEventArgs e)
 {
     var ad = ((TextBlock)e.OriginalSource).Text;
     e.Handled = true;
     Categroy.Visibility = Visibility.Collapsed;
     OpenForm(ad);
     pageState = PageState.Threads;
 }
Beispiel #48
0
        private void ListZones(PageState pageState, bool withPortlets)
        {
            string zoneNameFormat = @"  {0}";
            Dictionary<string, LocationInfo> locations = pageState.Locations;

            Dictionary<string, string> zones = GetZones(locations);

            foreach (string key in zones.Keys)
            {
                Console.WriteLine(zoneNameFormat, key);
                if (withPortlets)
                    ListWebPartsByZoneID(pageState, key);
            }
        }
Beispiel #49
0
        private void ListWebParts(PageState pageState)
        {
            string portletNameFormat = @"  {0} ({1})";
            Dictionary<string, LocationInfo> locations = pageState.Locations;

            foreach (string key in locations.Keys)
            {
                LocationInfo locationInfo = locations[key];
                Console.WriteLine(portletNameFormat, locationInfo.ControlID, locationInfo.ZoneID);
            }
        }
    private IEnumerator FetchCoroutine()
    {
        // set both sets of cached users as dirty
        overallUsers = null;
        todayUsers = null;

        overallPageState = PageState.Fetching;
        todayPageState = PageState.Fetching;

        // first we must fetch and cache high scores for overall
        ParseQuery<ParseUser> overallQuery = ParseUser.Query.
            WhereGreaterThan(ParseUserUtils.KEY_STREAK, 0).
            OrderByDescending (ParseUserUtils.KEY_STREAK).
                Limit (PAGINATION_AMOUNT);

        Task<IEnumerable<ParseUser>> overallTask = overallQuery.FindAsync ();

        DateTime startTime = DateTime.UtcNow;
        TimeSpan waitDuration = TimeSpan.FromSeconds(TimeUtils.TIMEOUT_DURATION);
        while (!overallTask.IsCompleted)
        {
            if(DateTime.UtcNow - startTime >= waitDuration)
                break;

            yield return null;
        }

        if(!overallTask.IsCompleted)
        {
            overallErrorInfo = new ErrorInfo(ErrorType.Timeout);
            overallPageState = PageState.Error;
        }
        else if (overallTask.IsFaulted)
        {
            using (IEnumerator<System.Exception> enumerator = overallTask.Exception.InnerExceptions.GetEnumerator())
            {
                if (enumerator.MoveNext())
                {
                    ParseException exception = (ParseException) enumerator.Current;
                    overallErrorInfo = new ErrorInfo(ErrorType.ParseException, exception.Code);
                }
                else
                {
                    overallErrorInfo = new ErrorInfo(ErrorType.ParseInternal);
                }
            }

            overallPageState = PageState.Error;
        }
        else
        {
            overallUsers = overallTask.Result.ToList();
            overallPageState = PageState.Ready;
        }

        if (leaderboardPage == LeaderboardPage.Overall)
            PromptOverall ();

        // now we load and cache todays high scores
        ParseQuery<ParseUser> todayQuery = ParseUser.Query.
            WhereGreaterThanOrEqualTo(ParseUserUtils.KEY_DAILY_TIMESTAMP, DateTime.UtcNow.Date).
            WhereGreaterThan(ParseUserUtils.KEY_DAILY_STREAK, 0).
            OrderByDescending (ParseUserUtils.KEY_DAILY_STREAK).
            Limit (PAGINATION_AMOUNT);

        Task<IEnumerable<ParseUser>> todayTask = todayQuery.FindAsync ();

        startTime = DateTime.UtcNow;
        waitDuration = TimeSpan.FromSeconds(TimeUtils.TIMEOUT_DURATION);
        while (!todayTask.IsCompleted)
        {
            if(DateTime.UtcNow - startTime >= waitDuration)
                break;

            yield return null;
        }

        if(!todayTask.IsCompleted)
        {
            todayErrorInfo = new ErrorInfo(ErrorType.Timeout);
            todayPageState = PageState.Error;
        }
        else if (todayTask.IsFaulted)
        {
            using (IEnumerator<System.Exception> enumerator = todayTask.Exception.InnerExceptions.GetEnumerator())
            {
                if (enumerator.MoveNext())
                {
                    ParseException exception = (ParseException) enumerator.Current;
                    todayErrorInfo = new ErrorInfo(ErrorType.ParseException, exception.Code);
                }
                else
                {
                    todayErrorInfo = new ErrorInfo(ErrorType.ParseInternal);
                }
            }

            todayPageState = PageState.Error;
        }
        else
        {
            todayUsers = todayTask.Result.ToList();
            todayPageState = PageState.Ready;
        }

        if (leaderboardPage == LeaderboardPage.Today)
            PromptToday ();
    }
Beispiel #51
0
        private string ResolveDescription(PageState page)
        {
            var resolved = new StringBuilder();
            resolved.AppendFormat("## {0}\n\n", page.Scene.Name);

            var firstToggleCounter = 0;
            for (var i = 0; i < page.State.ActionsToShow.Count; i++)
            {
                if (page.State.ActionsToShow[i])
                {
                    var actionTuple = _story.Actions.Single(a => a.Value.Id == i + 1);
                    var actionAnchors = Utilities.GetInstance(page.Scene.Name, page.Scene.LineNumber).ParseAnchors(actionTuple.Value.Description);
                    var anchorDict = GetStateDictionary(page);
                    if (
                        actionAnchors.Any(
                            a => a.Href.Conditions != null && a.Href.Conditions.ContainsKey(actionTuple.Key)))
                    {
                        if (page.State.ActionFirstToggles[firstToggleCounter++])
                        {
                            anchorDict[actionTuple.Key] = false;
                        }
                    }
                    resolved.AppendFormat("{0}\n\n", actionAnchors.Aggregate(actionTuple.Value.Description,
                        (current, anchor) =>
                            current.Replace(anchor.Original,
                                ResolveAnchor(page.Scene.Name, page.Scene.LineNumber, anchor, anchorDict,
                                    page.Links.ContainsKey(anchor.Original) ? page.Links[anchor.Original] : null))));
                }
            }

            var anchors = Utilities.GetInstance(page.Scene.Name, page.Scene.LineNumber).ParseAnchors(page.Scene.Description);
            var stateDict = GetStateDictionary(page);
            var text =
                RegexLib.EmptyListItem.Replace(
                    anchors.Aggregate(page.Scene.Description,
                        (current, anchor) =>
                            current.Replace(anchor.Original,
                                ResolveAnchor(page.Scene.Name, page.Scene.LineNumber, anchor, stateDict,
                                    page.Links.ContainsKey(anchor.Original) ? page.Links[anchor.Original] : null))),
                    string.Empty);
            var seen = page.State.ScenesSeen[page.Scene.Id - 1];
            resolved.Append(!seen
                ? RegexLib.BlockQuoteToken.Replace(text, string.Empty)
                : RegexLib.BlockQuotes.Replace(text, string.Empty));
            return resolved.ToString();
        }
Beispiel #52
0
 public static IDictionary<string, bool> GetStateDictionary(PageState page)
 {
     return page.StateMatrix.Where(matrix => page.State.PlayerState[matrix.Value])
         .ToDictionary(m => m.Key, m => true);
 }
Beispiel #53
0
 protected abstract void UpdateUiState(PageState newState);
Beispiel #54
0
        public PageState ResolveNewState(Anchor anchor, PageState current)
        {
            var target = anchor.Href.Target ?? current.Scene.Key;

            var newState = ClonePage(current);
            newState.State.ScenesSeen[current.Scene.Id - 1] = true;
            List<bool> actionFirstToggles = null;
            if (anchor.Href.Toggles != null)
            {
                foreach (var toggle in anchor.Href.Toggles)
                {
                    if (_story.Actions.ContainsKey(toggle))
                    {
                        if(actionFirstToggles == null) actionFirstToggles = new List<bool>();
                        newState.State.ActionsToShow[_story.Actions[toggle].Id - 1] = true;
                        if (
                            Utilities.GetInstance(_story.Actions[toggle].Toggle, _story.Actions[toggle].LineNumber).ParseAnchors(_story.Actions[toggle].Description)
                                .Any(a => a.Href.Conditions != null && a.Href.Conditions.ContainsKey(toggle)))
                            actionFirstToggles.Add(!current.State.PlayerState[_stateMatrix[toggle]]);
                    }
                    newState.State.PlayerState[_stateMatrix[toggle]] = true;
                }
            }
            newState.State.ActionFirstToggles = actionFirstToggles != null
                ? new BitArray(actionFirstToggles.ToArray())
                : null;
            newState.Scene = GetScene(current.Scene.Name, current.Scene.LineNumber, target, newState.State.PlayerState);
            return newState;
        }
Beispiel #55
0
        private void ChangeAppBar(PageState state)
        {
            ApplicationBar.Buttons.Clear();
            if (state != PageState.Image)
            {
                ApplicationBar.Mode = ApplicationBarMode.Default;
                ApplicationBar.Buttons.Add(categoryBtn);
                ApplicationBar.Buttons.Add(newpostBtn);
                ApplicationBar.Buttons.Add(jumptoBtn);
                ApplicationBar.Buttons.Add(refreshBtn);

            } else
            {
                ApplicationBar.Mode = ApplicationBarMode.Minimized;
                ApplicationBar.Buttons.Add(saveimageBtn);
                ApplicationBar.Buttons.Add(shareimageBtn);
            }
        }
        private void SetPageState(BlockPageId pba, PageState ps)
        {
            PageState ori = GetPageState(pba);
            if (ori == ps)
                return;

            switch (ori)
            {
                case PageState.Free:
                    blockStates[pba.BlockId].FreePageCount--;
                    break;
                case PageState.Allc:
                    blockStates[pba.BlockId].AllcPageCount--;
                    break;
                case PageState.Live:
                    blockStates[pba.BlockId].LivePageCount--;
                    break;
                case PageState.Dead:
                    blockStates[pba.BlockId].DeadPageCount--;
                    break;
            }

            blockStates[pba.BlockId].PageStates[pba.PageId] = ps;

            switch (ps)
            {
                case PageState.Free:
                    blockStates[pba.BlockId].FreePageCount++;
                    break;
                case PageState.Allc:
                    blockStates[pba.BlockId].AllcPageCount++;
                    break;
                case PageState.Live:
                    blockStates[pba.BlockId].LivePageCount++;
                    break;
                case PageState.Dead:
                    ushort deadpc = ++blockStates[pba.BlockId].DeadPageCount;
                    if (deadpc == dev.PageCountPerBlock)
                        MoveDirtyToDead(pba.BlockId);
                    break;
            }
        }
Beispiel #57
0
        private void ListWebPartsByZoneID(PageState pageState, string zoneId)
        {
            if (pageState == null)
                throw new ArgumentNullException("pageState");

            if (String.IsNullOrEmpty(zoneId))
                throw new ArgumentNullException("zoneId");

            string portletNameFormat = @"    {0}";
            var portlets = new List<string>();
            Dictionary<string, LocationInfo> locations = pageState.Locations;
            foreach (string webPartID in locations.Keys)
            {
                LocationInfo locationInfo = locations[webPartID];
                if (zoneId.Equals(locationInfo.ZoneID))
                    portlets.Add(locationInfo.ControlID);
            }
            foreach (string portletName in portlets)
            {
                Console.WriteLine(portletNameFormat, portletName);
            }
        }
Beispiel #58
0
 private PageState ClonePage(PageState page)
 {
     return new PageState
     {
         Id = Guid.NewGuid(),
         Links = new Dictionary<string, string>(),
         State = new State
         {
             PlayerState = page.State.PlayerState.Clone() as BitArray,
             ScenesSeen = page.State.ScenesSeen.Clone() as BitArray,
             ActionsToShow = new BitArray(_actionCount)
         },
         AffectedState = new State
         {
             PlayerState = new BitArray(_stateMatrix.Keys.Count),
             ScenesSeen = new BitArray(_sceneCount),
             ActionsToShow = new BitArray(_actionCount)
         },
         StateMatrix = _stateMatrix
     };
 }
Beispiel #59
0
        // Tools ///////////////////////////////////////////////////////////////////
		private void SaveNewPersonalizationSettings(SNP.Page page, PageState pageState)
        {
            string newSharedDataString = pageState.Encode();
            byte[] newSharedDataBlob = Convert.FromBase64String(newSharedDataString);

            page.PersonalizationSettings.SetStream(new MemoryStream(newSharedDataBlob));
            page.Save();
        }
Beispiel #60
0
 // 打开图片
 private void OpenImage(string url)
 {
     //string destination = "/ImagePage.xaml?imgurl=" + url;
     //this.NavigationService.Navigate(new Uri(destination, UriKind.Relative));
     bitImage = new BitmapImage(new Uri(url, UriKind.RelativeOrAbsolute));
     bitImage.DownloadProgress += BitImage_DownloadProgress;
     bitImage.ImageOpened += BitImage_ImageOpened;
   
     Image.Source = bitImage;
     ImageLayer.Visibility = Visibility.Visible;
     ImageProgressBar.Visibility = Visibility.Visible;
     ThreadLayer.Visibility = Visibility.Collapsed;
     pageState = PageState.Image;
     Image_ResetTransform();
     // 修改button,增加保存图片按钮
     ChangeAppBar(PageState.Image);
     
 }