public override void SetArticle(My_News news)
 {
     Dispatcher.BeginInvoke(new Action(() =>
     {
         this.titleBlock.Text    = news.Title;
         this.abstrackBlock.Text = news.Content;
     }));
 }
Beispiel #2
0
 public override void SetArticle(My_News news)
 {
     Dispatcher.BeginInvoke(new Action(() =>
     {
         this.titleBlock.Text = news.Title;
         this.abstrackBlock.Text = news.Content;
     }));
 }
Beispiel #3
0
        public void LoadCardLayout(String dir)
        {
            configFileDir = Path.Combine(Environment.CurrentDirectory, dir);
            if (File.Exists(configFileDir))
            {
                StreamReader reader   = new StreamReader(configFileDir);
                String       nextLine = "";
                while ((nextLine = reader.ReadLine()) != null)
                {
                    LoadingCard readCard = JsonConvert.DeserializeObject <LoadingCard>(nextLine);
                    int         zindex   = 0;
                    if (readCard.userID == "Alex" && STATICS.ALEX_ACTIVE ||
                        readCard.userID == "Ben" && STATICS.BEN_ACTIVE ||
                        readCard.userID == "Chris" && STATICS.CHRIS_ACTIVE ||
                        readCard.userID == "Danny" && STATICS.DANNY_ACTIVE)
                    {
                        News_Card myCard = new News_Card(loader.MainWindow.Controlers.CardControler, readCard.userID);
                        myCard.UUID  = readCard.cardID;
                        myCard.Owner = readCard.userID;
                        My_News news = new My_News();
                        news.Author   = readCard.author;
                        news.Title    = readCard.title;
                        news.Content  = readCard.content;
                        myCard.News   = news;
                        myCard.NewsID = readCard.newsID;
                        System.Windows.Media.Color color = System.Windows.Media.Colors.White;
                        switch (readCard.userID)
                        {
                        case "Alex":
                            color = STATICS.USER_COLOR_CODE[0];
                            break;

                        case "Ben":
                            color = STATICS.USER_COLOR_CODE[1];
                            break;

                        case "Chris":
                            color = STATICS.USER_COLOR_CODE[2];
                            break;

                        case "Danny":
                            color = STATICS.USER_COLOR_CODE[3];
                            break;
                        }
                        myCard.InitializeCard(color, new Point(readCard.position[0], readCard.position[1]), readCard.rotate, 1, zindex++);
                        Card_List.AddCard(myCard);
                        loader.MainWindow.Controlers.UserControler.ReceiveCard(readCard.userID, myCard);
                        loader.MainWindow.CardLayer.AddCard(myCard);
                        Canvas.SetZIndex(myCard, myCard.ZIndex);
                    }
                }
            }
        }
Beispiel #4
0
 public override void SetArticle(My_News news)
 {
     Dispatcher.BeginInvoke(new Action(() =>
     {
         this.titleBlock.Text = news.Title;
         if (news.Title.Length > 50)
         {
             titleBlock.FontSize = 15;
         }
         if (news.Title.Length > 100)
         {
             titleBlock.FontSize = 10;
         }
     }));
 }
Beispiel #5
0
 public override void SetArticle(My_News paper)
 {
     Dispatcher.BeginInvoke(new Action(() =>
     {
         textBlock.Text = paper.Title;
         if (paper.Title.Length > 50)
         {
             textBlock.FontSize = 15;
         }
         if (paper.Title.Length > 100)
         {
             textBlock.FontSize = 12;
         }
     }));
 }
Beispiel #6
0
        public override void SetArticle(My_News news)
        {
            Dispatcher.BeginInvoke(new Action(() =>
            {
                this.titleBlock.Text = news.Title;
                if (news.Title.Length > 50)
                {
                    titleBlock.FontSize = 15;

                }
                if (news.Title.Length > 100)
                {
                    titleBlock.FontSize = 10;
                }
            }));
        }
Beispiel #7
0
        public override void SetArticle(My_News paper)
        {
            Dispatcher.BeginInvoke(new Action(() =>
            {
                textBlock.Text = paper.Title;
                if (paper.Title.Length > 50)
                {
                    textBlock.FontSize = 15;

                }
                if (paper.Title.Length > 100)
                {
                    textBlock.FontSize = 12;

                }
            }));
        }
Beispiel #8
0
        private static My_News[] ReadData(String dataFile)
        {
            String         nextLine = "";
            List <My_News> list     = new List <My_News>();
            StreamReader   reader   = new StreamReader(dataFile);
            int            count    = 0;

            while ((nextLine = reader.ReadLine()) != null)
            {
                My_News newsData = JsonConvert.DeserializeObject <My_News>(nextLine);
                list.Add(newsData);
                count++;
                if (count > 100)
                {
                    break;
                }
            }
            return(list.ToArray());
        }
 public virtual void SetArticle(My_News paper)
 {
 }
 public void LoadCardLayout(String dir)
 {
     configFileDir = Path.Combine(Environment.CurrentDirectory, dir);
     if (File.Exists(configFileDir))
     {
         StreamReader reader = new StreamReader(configFileDir);
         String nextLine = "";
         while ((nextLine = reader.ReadLine()) != null)
         {
             LoadingCard readCard = JsonConvert.DeserializeObject<LoadingCard>(nextLine);
             int zindex = 0;
             if (readCard.userID == "Alex" && STATICS.ALEX_ACTIVE ||
                 readCard.userID == "Ben" && STATICS.BEN_ACTIVE ||
                 readCard.userID == "Chris" && STATICS.CHRIS_ACTIVE ||
                 readCard.userID == "Danny" && STATICS.DANNY_ACTIVE)
             {
                 News_Card myCard = new News_Card(loader.MainWindow.Controlers.CardControler, readCard.userID);
                 myCard.UUID = readCard.cardID;
                 myCard.Owner = readCard.userID;
                 My_News news = new My_News();
                 news.Author = readCard.author;
                 news.Title = readCard.title;
                 news.Content = readCard.content;
                 myCard.News = news;
                 myCard.NewsID = readCard.newsID;
                 System.Windows.Media.Color color= System.Windows.Media.Colors.White;
                 switch (readCard.userID) {
                     case "Alex":
                         color = STATICS.USER_COLOR_CODE[0];
                         break;
                     case "Ben":
                         color = STATICS.USER_COLOR_CODE[1];
                         break;
                     case "Chris":
                         color = STATICS.USER_COLOR_CODE[2];
                         break;
                     case "Danny":
                         color = STATICS.USER_COLOR_CODE[3];
                         break;
                 }
                 myCard.InitializeCard(color, new Point(readCard.position[0], readCard.position[1]), readCard.rotate, 1, zindex++);
                 Card_List.AddCard(myCard);
                 loader.MainWindow.Controlers.UserControler.ReceiveCard(readCard.userID, myCard);
                 loader.MainWindow.CardLayer.AddCard(myCard);
                 Canvas.SetZIndex(myCard, myCard.ZIndex);
             }
         }
     }
 }
Beispiel #11
0
 public virtual void SetArticle(My_News paper)
 {
 }