Пример #1
0
        /// <summary>
        /// 巡覽期間以傳遞的內容填入頁面。從之前的工作階段
        /// 重新建立頁面時,也會提供儲存的狀態。
        /// </summary>
        /// <param name="navigationParameter">最初要求這個頁面時,傳遞到
        /// <see cref="Frame.Navigate(Type, Object)"/> 的參數。
        /// </param>
        /// <param name="pageState">這個頁面在先前的工作階段期間保留的
        /// 狀態字典。第一次瀏覽頁面時,這一項是 null。</param>
       async protected override void LoadState(Object navigationParameter, Dictionary<String, Object> pageState)
        {
            // TODO: 將可繫結群組的集合指派給 this.DefaultViewModel["Groups"]
            Service.SSHMCDataServiceClient client = new Service.SSHMCDataServiceClient();
            
            try
            {
             ObservableCollection<Service.vwReportNotified>   q = await client.GettblReportNotifiedAsync(App.UserID);
             var res = from n in q orderby n.TYPE,n.DATATIME descending
                       group n by new { n.SITE_ID ,n.SITE_NAME} into g
                       select new BindingData { Title = g.Key.SITE_NAME, TopItems = g.ToList() };
             this.DefaultViewModel["Groups"] = res.ToList();
            }
            catch (FaultException ex)
            {

                //string msg = "FaultException: " + ex.Message;
                //MessageFault fault = ex.CreateMessageFault();
                //if (fault.HasDetail == true)
                //{
                //    System.Xml.XmlReader reader = fault.GetReaderAtDetailContents();
                //    if (reader.Name == "ExceptionDetail")
                //    {
                //        ExceptionDetail detail = fault.GetDetail<ExceptionDetail>();
                //        msg += "\n\nStack Trace: " + detail.StackTrace;
                //    }
                //}


                   new MessageDialog(ex.Message).ShowAsync();
            }
           
         
        }
Пример #2
0
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            Exception ex = null;
            Service.SSHMCDataServiceClient client = new Service.SSHMCDataServiceClient();
            try
            {
                bool success = await client.CheckUserIDPasswordAsync(txtAccount.Text.Trim(), txtpwd.Password.Trim());
           
                    if (success)
                    {
                        this.Frame.Navigate(typeof(SiteView), txtAccount.Text);
                        App.IsLogin = true;
                    }
                    else
                    {
                        MessageDialog dlg = new MessageDialog("帳號或密碼錯誤!", "SSHMC");
                        await dlg.ShowAsync();
                    }

            }
            catch (Exception ex1)
            {
                ex = ex1;
            }
            if (ex != null)
                await new MessageDialog(ex.Message).ShowAsync();


        }
Пример #3
0
        private async void webView1_LoadCompleted(object sender, NavigationEventArgs e)
        {
            //   InsertNews("cute", "2013/4/1 12:00:00", "蘋果迷照過來,iPhone5S和5C第一批水貨在台灣落地,東森新聞獨家取得實測,首次開賣的5S金色版,從機身到包裝盒都燙金,難怪價格昂貴,水貨喊價飆到7萬元,而5C的塑膠外殼,表面質感相當光滑,但要價也不便宜,水貨一隻2萬6起跳。香檳金的邊框與背部機身,連包裝盒也是貴氣十足的燙金邊,想搶先擁有一隻64G版本價格,已經喊到7萬天價。就算價格再貴,台灣的蘋果迷們也迫不急待一睹5S真面目。不只5S,首波iPhone5c也在東森新聞獨家曝光,長的跟iphone5差不多,只是穿上多彩的塑膠外。但5C水貨也不便宜,16G 2萬6,32G則要3萬元,看來不管5S還是5C,果迷們想搶先擁有新機,口袋得夠深才行。"
            // , "main");
             
            //InsertNews("cute", "2013/4/1 12:00:00", "蘋果迷照過來,iPhone5S和5C第一批水貨在台灣落地,東森新聞獨家取得實測,首次開賣的5S金色版,從機身到包裝盒都燙金,難怪價格昂貴,水貨喊價飆到7萬元,而5C的塑膠外殼,表面質感相當光滑,但要價也不便宜,水貨一隻2萬6起跳。香檳金的邊框與背部機身,連包裝盒也是貴氣十足的燙金邊,想搶先擁有一隻64G版本價格,已經喊到7萬天價。就算價格再貴,台灣的蘋果迷們也迫不急待一睹5S真面目。不只5S,首波iPhone5c也在東森新聞獨家曝光,長的跟iphone5差不多,只是穿上多彩的塑膠外。但5C水貨也不便宜,16G 2萬6,32G則要3萬元,看來不管5S還是5C,果迷們想搶先擁有新機,口袋得夠深才行。"
            //  , "main2");

            //InsertNews("cute", "2013/4/1 12:00:00", "蘋果迷照過來,iPhone5S和5C第一批水貨在台灣落地,東森新聞獨家取得實測,首次開賣的5S金色版,從機身到包裝盒都燙金,難怪價格昂貴,水貨喊價飆到7萬元,而5C的塑膠外殼,表面質感相當光滑,但要價也不便宜,水貨一隻2萬6起跳。香檳金的邊框與背部機身,連包裝盒也是貴氣十足的燙金邊,想搶先擁有一隻64G版本價格,已經喊到7萬天價。就算價格再貴,台灣的蘋果迷們也迫不急待一睹5S真面目。不只5S,首波iPhone5c也在東森新聞獨家曝光,長的跟iphone5差不多,只是穿上多彩的塑膠外。但5C水貨也不便宜,16G 2萬6,32G則要3萬元,看來不管5S還是5C,果迷們想搶先擁有新機,口袋得夠深才行。"
            // , "main3");
            //InsertNews("cute", "2013/4/1 12:00:00", "蘋果迷照過來,iPhone5S和5C第一批水貨在台灣落地,東森新聞獨家取得實測,首次開賣的5S金色版,從機身到包裝盒都燙金,難怪價格昂貴,水貨喊價飆到7萬元,而5C的塑膠外殼,表面質感相當光滑,但要價也不便宜,水貨一隻2萬6起跳。香檳金的邊框與背部機身,連包裝盒也是貴氣十足的燙金邊,想搶先擁有一隻64G版本價格,已經喊到7萬天價。就算價格再貴,台灣的蘋果迷們也迫不急待一睹5S真面目。不只5S,首波iPhone5c也在東森新聞獨家曝光,長的跟iphone5差不多,只是穿上多彩的塑膠外。但5C水貨也不便宜,16G 2萬6,32G則要3萬元,看來不管5S還是5C,果迷們想搶先擁有新機,口袋得夠深才行。"
            //, "main1");

            Service.SSHMCDataServiceClient client = new Service.SSHMCDataServiceClient();
            Exception ex = null;
            try
            {
                System.Collections.ObjectModel.ObservableCollection<Service.tblPre_disasterNotified> preDisasterInfos = await client.GetDisasterInfoAsync();
                foreach (Service.tblPre_disasterNotified info in preDisasterInfos)
                {
                    string classtype = "side";

                    if (info.PRE_ADMONISH_CLASS.Contains("雨"))
                        classtype = "main2";
                    else if (info.PRE_ADMONISH_CLASS.Contains("地震") || info.PRE_ADMONISH_CLASS.Contains("颱風"))
                        classtype = "side";
                    
                    webView1.InvokeScript("InsertNews",new string[]{info.TITLE,((DateTime)info.TIMESTAMP).ToString("yyyy/MM/dd hh:mm:ss"),info.CONTENT,classtype});
                }
            
            
            }
            catch (Exception ex1)
            {
               ex=
                   ex1; 
                
            }

            if (ex != null)
            {
              await  new MessageDialog(ex.Message, "SSHMC").ShowAsync();
            }

//webView1.InvokeScript("InsertNews",new string[]{"cute", "2013/4/1 12:00:00", "蘋果迷照過來,iPhone5S和5C第一批水貨在台灣落地,東森新聞獨家取得實測,首次開賣的5S金色版,從機身到包裝盒都燙金,難怪價格昂貴,水貨喊價飆到7萬元,而5C的塑膠外殼,表面質感相當光滑,但要價也不便宜,水貨一隻2萬6起跳。香檳金的邊框與背部機身,連包裝盒也是貴氣十足的燙金邊,想搶先擁有一隻64G版本價格,已經喊到7萬天價。就算價格再貴,台灣的蘋果迷們也迫不急待一睹5S真面目。不只5S,首波iPhone5c也在東森新聞獨家曝光,長的跟iphone5差不多,只是穿上多彩的塑膠外。但5C水貨也不便宜,16G 2萬6,32G則要3萬元,看來不管5S還是5C,果迷們想搶先擁有新機,口袋得夠深才行。"
//            , "main"});
        }
Пример #4
0
        public async Task UpdateCharts(int SensorId,DateTime StarTime,DateTime EndTime)
        {

            try
            {
            client = new Service.SSHMCDataServiceClient();

            var q = await (client.GetvwSensorValuesAndTC10MinDataLogAsync(SensorId,StarTime,EndTime));

            PlotSeriesData[] seriesdata = new PlotSeriesData[]{
                new PlotSeriesData(){ Items=new System.Collections.ObjectModel.ObservableCollection<NameValueItem>()},
                  new PlotSeriesData(){ Items=new System.Collections.ObjectModel.ObservableCollection<NameValueItem>()},
                    new PlotSeriesData(){ Items=new System.Collections.ObjectModel.ObservableCollection<NameValueItem>()}
            };

            foreach (var i in q)
            {
                if (i.TIMESTAMP.Minute != 0)
                    continue;
                seriesdata[0].Items.Add(new NameValueItem() { X_Label = i.TIMESTAMP.Hour.ToString(), Value = i.VALUE0 ?? 0 });
                seriesdata[1].Items.Add(new NameValueItem() { X_Label = i.TIMESTAMP.Hour.ToString(), Value = i.VALUE1 ?? 0 });
                seriesdata[2].Items.Add(new NameValueItem() { X_Label = i.TIMESTAMP.Hour.ToString(), Value = i.VALUE2 ?? 0 });

            }

            if (q.Count != 0)
            {
                if (LineChart0.LegendItems.Count != 0)
                    LineChart0.LegendItems.RemoveAt(0);
                if (LineChart1.LegendItems.Count != 0)
                    LineChart1.LegendItems.RemoveAt(0);
                if (LineChart2.LegendItems.Count != 0)
                    LineChart2.LegendItems.RemoveAt(0);



                //LinearAxis liAxis = LineChart0.Series[0] as LinearAxis;

                //liAxis.Background = new SolidColorBrush() { Color = Windows.UI.Colors.Green };
                ((LineSeries)LineChart0.Series[0]).Background = new SolidColorBrush() { Color = Windows.UI.Colors.Green };
                ((LineSeries)LineChart1.Series[0]).Background = new SolidColorBrush() { Color = Windows.UI.Colors.Green };
                ((LineSeries)LineChart2.Series[0]).Background = new SolidColorBrush() { Color = Windows.UI.Colors.Green };

                //Style style = new Style();
                //Setter setterWidth = new Setter(){ Property = LineDataPoint.WidthProperty,Value = 0};
                //Setter setterHeight = new Setter() { Property = LineDataPoint.HeightProperty, Value = 0 };
                
                
                //Type type = typeof(LineDataPoint);
                //style.TargetType = type;
                //style.Setters.Add(setterHeight);
                //style.Setters.Add(setterWidth);

                //((LineSeries)LineChart0.Series[0]).DataPointStyle = style;
                //((LineSeries)LineChart1.Series[0]).DataPointStyle = style;
                //((LineSeries)LineChart2.Series[0]).DataPointStyle = style;


       



                //LineChart0.Axes.;
                if (seriesdata[0].Max != seriesdata[0].Min)
                {
                    ((LineSeries)this.LineChart0.Series[0]).DependentRangeAxis = new LinearAxis() { Minimum = seriesdata[0].Min, Maximum = seriesdata[0].Max, Orientation = AxisOrientation.Y, ShowGridLines = true };
                }
                if (seriesdata[1].Max != seriesdata[1].Min)
                {
                    ((LineSeries)this.LineChart1.Series[0]).DependentRangeAxis = new LinearAxis() { Minimum = seriesdata[1].Min, Maximum = seriesdata[1].Max, Orientation = AxisOrientation.Y, ShowGridLines = true };
                }
                if (seriesdata[2].Max != seriesdata[2].Min)
                {
                    ((LineSeries)this.LineChart2.Series[0]).DependentRangeAxis = new LinearAxis() { Minimum = seriesdata[2].Min, Maximum = seriesdata[2].Max, Orientation = AxisOrientation.Y, ShowGridLines = true };
                }



                ((LineSeries)this.LineChart0.Series[0]).ItemsSource = seriesdata[0].Items;
                ((LineSeries)this.LineChart1.Series[0]).ItemsSource = seriesdata[1].Items;
                ((LineSeries)this.LineChart2.Series[0]).ItemsSource = seriesdata[2].Items;

                

                LineChart0.Title = "X";
                LineChart1.Title = "Y";
                LineChart2.Title = "Z";



                CategoryAxis cate = LineChart0.ActualAxes[0] as CategoryAxis;
                cate.Opacity = 1;
                cate.Title = "hour";

                CategoryAxis cate1 = LineChart1.ActualAxes[0] as CategoryAxis;
                cate1.Opacity = 1;
                cate1.Title = "hour";

                CategoryAxis cate2 = LineChart2.ActualAxes[0] as CategoryAxis;
                cate2.Opacity = 1;
                cate2.Title = "hour";
                //cate.Visibility = Windows.UI.Xaml.Visibility.Collapsed;

                //WinRTXamlToolkit.Controls.DataVisualization.Charting.CategoryAxis ca = new CategoryAxis();
          
            }
            else
            {
                //MessageBoxFun("無資料!!!");
                

            }
            }
            catch (Exception ex)
            {
            }

            DateTimeBlock.Text = StarTime.ToString("yyyy/MM/dd");
            
        }