Ejemplo n.º 1
0
        /// <summary>
        /// 获取
        /// </summary>
        /// <returns></returns>
        public string Get()
        {
            var str = Isolated.Get(IsolatedHelper.TweetDraftKey);

            if (str != null)
            {
                return(str.ToString());
            }
            return("");
        }
Ejemplo n.º 2
0
        private void OnChangeCity(Citys city)
        {
            //JobsList.Clear();
            // UList.Clear();
            Isolated.Set("CurrentCity", city.City);
            JobDal.Instance.GetJobslist(getCurrentTime(), city.City, null, GetJobListEnd);
            CityDal.Instance.GetCityUniversity((string)Isolated.Get("CurrentCity"), GetCityUniversityEnd);

            Messenger.Default.Send <string>(city.City, "ChangeCityComplete");
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 获取我最近输入的话题
        /// </summary>
        /// <param name="count">获取条数</param>
        /// <returns></returns>
        public static List <string> GetRecent(int count = 0)
        {
            var ht = (List <string>)Isolated.Get(IsolatedHelper.HuaTiKey);

            if (ht == null)
            {
                return(new List <string>());
            }
            if (count > 0)
            {
                count = Math.Min(count, ht.Count);
                ht    = ht.Take(count).ToList();
            }
            return(ht);
        }
Ejemplo n.º 4
0
        void RootFrame_Navigating(object sender, NavigatingCancelEventArgs e)
        {
            bool b = false;

            if (Isolated.Get("IsSinaLogin") != null)
            {
                b = (bool)Isolated.Get("IsSinaLogin");
            }

            if (e.Uri.ToString().Contains("LoginPage.xaml") && b)
            {
                e.Cancel = true;//取消事件
                string uriString = "/View/MainPage.xaml";
                Uri    ur        = new Uri(uriString, UriKind.Relative);
                this.RootFrame.Dispatcher.BeginInvoke(delegate
                {
                    this.RootFrame.Navigate(ur);
                });
            }
        }
Ejemplo n.º 5
0
 private void ShareListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     Messenger.Default.Send <string>("", "JobDetailShareCompleted");
     if (ShareListBox.SelectedIndex == 0)
     {
         SmsComposeTask task = new SmsComposeTask();
         task.Body = shareText;
         task.Show();
     }
     else if (ShareListBox.SelectedIndex == 1)
     {
         EmailComposeTask task = new EmailComposeTask();
         task.Body = shareText;
         task.Show();
     }
     else if (ShareListBox.SelectedIndex == 2)
     {
         if (!(bool)Isolated.Get("IsSinaLogin"))
         {
             Messenger.Default.Send <string>("", "NavigateToLoginPage");
             //if (Application.Current.RootVisual is Page)
             //{
             //    ((Page)(Application.Current.RootVisual)).NavigationService.Navigate(uri);
             //}
         }
         else
         {
             SinaShareDal.Instance.SinaTextShare(weiShareText, () =>
             {
                 DispatcherHelper.CheckBeginInvokeOnUI(() =>
                 {
                     MessageBox.Show("分享成功");
                 });
             });
         }
     }
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public MainViewModel()
        {
            //string c = (string)Isolated.Get("CurrentCity");
            // string cookie = (string)Isolated.Get("cookiesName");
            JobsList       = new ObservableCollection <Job>();
            HotCityList    = new ObservableCollection <Citys>();
            UList          = new ObservableCollection <string>();
            JobNewsList    = new ObservableCollection <JobNews>();
            CollectJobList = new ObservableCollection <CollectJob>(CollectJobDal.Instance.GetCollectJobList());
            CityDal.Instance.GetHotCitys(GetHotCityListEnd);
            JobNewsDal.Instance.GetJobNewsList(getCurrentTime(), GetJobNewsListEnd);


            var immediate = new ImmediateLocation(x => { Get_CityNameOnMap(x); });

            immediate.GetLocation();


            SelectJobCommand        = new RelayCommand <Job>((job) => NavigatedJobDetail(job));
            SelectCollectJobCommand = new RelayCommand <CollectJob>((job) => NavigatedJobDetail(job));
            SelectCityCommand       = new RelayCommand <Citys>((city) => OnChangeCity(city));
            SelectJobNewsCommand    = new RelayCommand <JobNews>((jobNews) =>
            {
                if (jobNews != null)
                {
                    Messenger.Default.Send <string>(@"/View/JobNewsDetailPage.xaml?id=" + jobNews.Id + "&name=" + jobNews.Title, "NavigateToJobNewsDetail");
                }
            });
            SelectMoreItemCommand = new RelayCommand <int>((index) => DealWithMoreItem(index));

            ChangeSchoolCommand = new RelayCommand <int>((i) =>
            {
                string city = (string)Isolated.Get("CurrentCity");
                if (i >= 0 && i < UList.Count && !string.IsNullOrEmpty(UList[i]))
                {
                    OnChangeSchool(city, UList[i]);
                }
            });
            Messenger.Default.Register <string>(this, "collectJobCompleted",
                                                jobId =>
            {
                if (jobId != null)
                {
                    CollectJobList.Add(CollectJobDal.Instance.GetNewInsertCollectJobItem(jobId));
                    //foreach(Job job in JobsList)
                    //    if(job.Id.Equals(jobId))
                    //    {
                    //        JobsList.Remove(job);
                    //        break;
                    //    }
                }
            }
                                                );
            Messenger.Default.Register <string>(this, "UpdateCollectJobList",
                                                empty =>
            {
                if (empty != null)
                {
                    DetailJob detailJob = (App.Current as App).CurrentJob;
                    foreach (CollectJob job  in CollectJobList)
                    {
                        if (job.JobId.Equals(detailJob.JobId))
                        {
                            job.AddressDetail = detailJob.AddressDetail;
                            job.StartTime     = detailJob.StartTime;
                            job.Status        = detailJob.Status;
                            job.University    = detailJob.University;
                            job.NoteText      = detailJob.NoteText;
                        }
                    }
                }
            }
                                                );
            Messenger.Default.Register <string>(this, "UnCollectJobCompleted",
                                                jobId =>
            {
                if (jobId != null)
                {
                    DetailJob detailJob = (App.Current as App).CurrentJob;
                    foreach (CollectJob job in CollectJobList)
                    {
                        if (detailJob.JobId.Equals(job.JobId))
                        {
                            CollectJobList.Remove(job);
                            break;
                        }
                    }
                }
            }
                                                );
            Messenger.Default.Register <string>(this, "Refresh",
                                                empty =>
            {
                JobDal.Instance.GetJobslist(getCurrentTime(), CurrentCity, null
                                            , GetJobListEnd);
                JobNewsDal.Instance.GetJobNewsList(getCurrentTime(), GetJobNewsListEnd);
            }
                                                );
            Messenger.Default.Register <string>(this, "SearchCityCompleted",
                                                cityName =>
            {
                OnChangeCity(new Citys()
                {
                    City = cityName, Count = "0"
                });
            }
                                                );
            Messenger.Default.Register <string>(this, "ShareJobList",
                                                empty =>
            {
                string shareContent = "大家快来关注";
                if (CurrentCity != null)
                {
                    shareContent += CurrentCity;
                }
                if (CurrentUniversity != null)
                {
                    shareContent += " " + CurrentUniversity;
                }
                shareContent += "的宣讲会吧!(来自 @歪伯乐校园招聘 http://www.ybole.com/xyzp";
                SinaShareDal.Instance.SinaShareWithCityAndUniversity(CurrentCity, CurrentUniversity, shareContent, () =>
                {
                    DispatcherHelper.CheckBeginInvokeOnUI(() =>
                    {
                        MessageBox.Show("宣讲会分享成功");
                    });
                });
            }
                                                );
            Messenger.Default.Register <string>(this, "JobListBoxRefresh",
                                                empty =>
            {
                JobDal.Instance.GetJobslist(getCurrentTime(), CurrentCity, CurrentUniversity
                                            , GetJobListEnd);
            }
                                                );
            Messenger.Default.Register <string>(this, "JobListBoxLoad",
                                                empty =>
            {
                JobDal.Instance.GetJobslist(JobsList[JobsList.Count - 1].startTime, CurrentCity, CurrentUniversity
                                            , GetAddJobListEnd);
            }
                                                );
            Messenger.Default.Register <Job>(this, "JobListSelectionChange",
                                             job =>
            {
                SelectJobCommand.Execute(job);
            }
                                             );
        }