Esempio n. 1
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            if (ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"))
            {
                HardwareButtons.BackPressed += HardwareButtons_BackPressed;
            }

            var previousPage = FrameExtensions.GetPreviousPage(Frame);

            if (previousPage != null)
            {
                previousPage._isLeaving = true;
                var previousPageHost = PreviousPageHost;
                if (previousPageHost != null)
                {
                    previousPageHost.Content = previousPage;
                    await previousPage.WaitForLoadedAsync();

                    await previousPage.PlayLeaveAnimationAsync(e.NavigationMode);

                    previousPageHost.Content = null;
                }
                FrameExtensions.SetPreviousPage(Frame, null);
                previousPage._isLeaving = false;
            }
        }
Esempio n. 2
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            if (ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"))
            {
                HardwareButtons.BackPressed += HardwareButtons_BackPressed;
            }

            SetTitleBar(TitleBar);

            var previousPage = FrameExtensions.GetPreviousPage(Frame);

            if (previousPage != null)
            {
                previousPage._isLeaving       = true;
                PreviousPageContainer.Content = previousPage;
                await previousPage.WaitForLoadedAsync();

                var leaveStoryboard = previousPage.GetLeaveStoryboard(e.NavigationMode);
                if (leaveStoryboard != null)
                {
                    await leaveStoryboard.BeginAsync();
                }
                PreviousPageContainer.Content = null;
                FrameExtensions.SetPreviousPage(Frame, null);
                previousPage._isLeaving = false;
            }
        }
Esempio n. 3
0
        protected override void OnNavigatedFrom(NavigationEventArgs e)
        {
            base.OnNavigatedFrom(e);

            if (ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"))
            {
                HardwareButtons.BackPressed -= HardwareButtons_BackPressed;
            }

            FrameExtensions.SetPreviousPage(Frame, this);
        }
Esempio n. 4
0
 public void Can_convert_to_2d_Array()
 {
     //TODO
     var df  = GetTestDataFrame();
     var res = FrameExtensions.ToArray2D <string, int, string>(df);
 }
        /// <summary>
        /// This code is based on the code developed by Chris Bayley
        /// </summary>
        public void Example01()
        {
            Console.WriteLine("Running Example01...");

            // Systems we want to see in the chart
            Tuple <long, String, Color>[] systemIds =
            {
                Tuple.Create(110751645L, "Stock Growth",  Color.Red),
                Tuple.Create(125206069L, "Marlin",        Color.LightBlue),
                Tuple.Create(106600099L, "VIXTrader Pro", Color.LightGreen)
            };

            // Set a preliminary Start Date
            DateTime StartDate = DateTime.Parse("1-feb-2008");

            // Find earliest start date common to all systems
            foreach (var id in systemIds)
            {
                DateTime sysStartDate = (from s in C2SYSTEMS
                                         where s.SystemId == id.Item1
                                         select s.Started).First();

                if (DateTime.Compare(sysStartDate, StartDate) > 0)
                {
                    StartDate = sysStartDate;
                }
            }

            // Get the Monthly equity data
            ITimeSheet timeSheet = TimeSheetFactory(systemIds.Select(id => id.Item1), TimeInterval.Month, EquityType.Equity);

            // ===================================================================
            // Here, a developer writes the exactly same code as on the web page.
            // ===================================================================
            // Say - a developer wants to play with timeSheet.
            // IntelliSense in action:
            var Developer_Trying_To_Do_Something = timeSheet.Commissions.CalcCommissions(systemIds[0].Item1);

            TABLE = timeSheet.GetEquitiesSheet();

            //// Create a chart object
            //ITimeSeriesChart chart = new TimeSeriesChart();
            //chart.Name = String.Format("Chris Bayley Chart");

            //// Add data
            //foreach (Tuple<long, String, Color> system in systemIds)
            //{
            //	chart.Add(timeSheet.GetColumn(system.Item1, EquityType.Equity), system.Item2, system.Item3);
            //}

            //// Enjoy!
            //CHART = chart;

            // return the EquitySheet as a Deedle.Frame
            var sparseEquityFrame = timeSheet.DataFrame;

            // Drop the rows from the frame which dont have data for all systems
            var denseEquityFrame = FrameModule.DropSparseRows(sparseEquityFrame);

            // ??? QUESTION 1:
            // Now I have the data I want in denseEquityFrame and I wish to convert it to IEnumerable for display by TABLE=
            IEnumerable <string> rowKeyNames = new string[] { "KeyName" };
            var equityDataTable = denseEquityFrame.ToDataTable(rowKeyNames);
            // Next line yields this error:
            // *** Error: Error CS0266: 139:7 Cannot implicitly convert type 'System.Data.DataTable' to
            // 'System.Collections.Generic.IEnumerable<object>'. An explicit conversion exists (are you missing a cast?)
            // If an explict conversion exits, what is it ??
            //TABLE=equityDataTable;

            // ??? QUESTION 2:
            // return Equity Sheet as IEnumerable to use with TABLE=
            // I can do this but it includes Dates I don't want
            var equityTable = timeSheet.GetEquitiesSheet();

            // So I'd like to do this:
            // equityTable =  timeSheet.GetEquitiesSheet().Where(z => z.Item1 >= StartDate);
            // but that yields:
            // *** Error: Error CS1061: 146:62 'object' does not contain a definition for 'Item1' and no extension method 'Item1'
            // accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)
            TABLE = equityTable;


            // ============ LOCAL DEBUGGING IN VISUAL STUDIO ========
            FrameExtensions.Print(denseEquityFrame);
            //FrameExtensions.Print(((Frame<DateTime, string>)equityTable.ElementAt(1)).GetFrameData());
            FrameExtensions.Print <DateTime, string>(timeSheet.DataFrame);

            Console.WriteLine("Example01 done. Press ENTER");
            Console.ReadLine();
        }