Exemplo n.º 1
0
 public void ChangeHeader(Pivot p) {
     var model = p.SelectedItem;
     if (model != null) {
         var view = ViewLocator.LocateForModel(model, null, null);
         TopHeader.LastHeaderFrom = view;
     }
 }
Exemplo n.º 2
0
 public override void ParseJson(JSONNode json)
 {
     Size = json["size"].AsFloat;
     Shift = json["shift"].AsFloat;
     Direction = (Direction)Enum.Parse(typeof(Direction), json["direction"].ToString().Replace("\"", ""));
     Pivot = (Pivot)Enum.Parse(typeof(Pivot), json["pivot"].ToString().Replace("\"", ""));
 }
Exemplo n.º 3
0
		public static Vector2 PivotEnumToVector2(Pivot pivot)
		{
			switch (pivot)
			{
				case Pivot.TopLeft:
					return new Vector2(0.0f, 1.0f);
				case Pivot.Left:
					return new Vector2(0.0f, 0.5f);
				case Pivot.BottomLeft:
					return new Vector2(0.0f, 0.0f);
				case Pivot.Top:
					return new Vector2(0.5f, 1.0f);
				case Pivot.Center:
					return new Vector2(0.5f, 0.5f);
				case Pivot.Bottom:
					return new Vector2(0.5f, 0.0f);
				case Pivot.TopRight:
					return new Vector2(1.0f, 1.0f);
				case Pivot.Right:
					return new Vector2(1.0f, 0.5f);
				case Pivot.BottomRight:
					return new Vector2(1.0f, 0.0f);
				default:
					return new Vector2(0.5f, 0.5f);
			}
		}
 private void LocalDataSourceProvider_PrepareDescriptionForField(object sender, Pivot.Core.PrepareDescriptionForFieldEventArgs e)
 {
     if (e.DescriptionType == Telerik.Pivot.Core.DataProviderDescriptionType.Group && e.FieldInfo.Name == "Product")
     {
         e.Description = new FirstLetterGroupDescription() { PropertyName = "Product" };
     }
 }
        /// <summary>
        /// Adds all questions in category to pivot page. Each caterogy will be in seperate pivot.
        /// </summary>
        /// <param name="pivot">Pivot name to which categories should be added.</param>
        public void AddCategoriesToPivot(Pivot pivot)
        {
            foreach (Category cat in Survey.Categories)
            {
                if (cat is NormalCategory)
                {
                    CategoryControl categoryControl = new CategoryControl();
                    PreviewCategoryViewModel normalCategoryViewModel = new PreviewCategoryViewModel(((NormalCategory)cat));
                    normalCategoryViewModel.AddQuestionsToListBox(categoryControl.QuestionsList);

                    PivotItem item = new PivotItem();
                    item.Header = ((NormalCategory)cat).Name;
                    item.Content = categoryControl;
                    pivot.Items.Add(item);
                }
                else if (cat is ConditionCategory)
                {
                    ConditionCategory category = (ConditionCategory)cat;
                    PreviewConditionCategoryPage categoryControl = new PreviewConditionCategoryPage();

                    categoryControl.DataContext = category;

                    PivotItem item = new PivotItem();
                    item.Header = category.Name;
                    item.Content = categoryControl;
                    pivot.Items.Add(item);
                }
            }
            Survey.RefreshQuestionsVisibility();
        }
Exemplo n.º 6
0
        public CategoryPageVM(Pivot pivot)
        {
            _pivot = pivot;
            SetDebugModeIf();

            // Can not call LoadCategories here, we do not know the Category.FriendlyUrl
            //
            //LoadCategories();
        }
Exemplo n.º 7
0
 private void aq_PivotItemLoading(Pivot sender, PivotItemEventArgs args)
 {
     if (aq.SelectedItem == ra)
         sub.Visibility = Visibility.Visible;
     else
         sub.Visibility = Visibility.Collapsed;
         
         
 }
Exemplo n.º 8
0
 protected override void WriteObject(AssetsWriter writer)
 {
     base.WriteBase(writer);
     AnchorMin.Write(writer);
     AnchorMax.Write(writer);
     AnchoredPosition.Write(writer);
     SizeDelta.Write(writer);
     Pivot.Write(writer);
 }
        protected override Task OnInitializedAsync()
        {
            if (Pivot is not null)
            {
                Pivot.RegisterOption(this);
            }

            return(base.OnInitializedAsync());
        }
        private bool MovePivot(Pivot pivot)
        {
            bool result = false;
            if (PivotNext)
            {
                pivot.SelectedIndex = (pivot.SelectedIndex + 1)%pivot.Items.Count;
                result = true;
            }
            else if (PivotLast)
            {
                if (pivot.SelectedIndex == 0)
                {
                    pivot.SelectedIndex = pivot.Items.Count - 1;
                    result = true;
                }
                else
                {
                    pivot.SelectedIndex = pivot.SelectedIndex - 1;
                    result = true;
                }
            }
            else if (!string.IsNullOrWhiteSpace(PivotName))
            {
                var index = 0;
                var pivotFound = false;

                foreach (var pivotItem in pivot.Items.Cast<PivotItem>())
                {
                    if (pivotItem.Name.ToLowerInvariant().StartsWith(PivotName.ToLowerInvariant()) ||
                        pivotItem.GetValue(AutomationProperties.NameProperty)
                                 .ToString()
                                 .ToLowerInvariant()
                                 .StartsWith(PivotName.ToLowerInvariant()))
                    {
                        pivotFound = true;
                        break;
                    }
                    index++;
                }

                if (pivotFound)
                {
                    pivot.SelectedIndex = index;
                    result = true;
                }
                else
                {
                    SendNotFoundResult(string.Format("PivotCommand: Could not find the Pivot : {0}", PivotName));
                }
            }
            else
            {
                SendNotFoundResult("PivotCommand: Could not find the pivot");
            }

            return result;
        }
        public void Dispose()
        {
            if (Pivot is null)
            {
                return;
            }

            Pivot.UnregisterOption(this);
        }
        /// <summary>
        /// Lazy loading of pivot tabs for perf.
        /// only load a tab when a user access it
        /// Naturally all pivots are loaded when the control is created (we dont want this)
        /// </summary>
        private void UpdateTabInfoOnPivotLoading(Pivot sender, PivotItemEventArgs args)
        {
            int currentTabIndex = PhoneTabs.SelectedIndex;
            //Set device oritentation based on tab
            switch (currentTabIndex)
            {
                //For the contact and dialer tabs, we should disable landscape
                case 1:
                case 2:
                    DisplayInformation.AutoRotationPreferences = DisplayOrientations.Portrait;
                    break;
                //Other tabs can be both portrait and landscape
                default:
                    DisplayInformation.AutoRotationPreferences =
                        DisplayOrientations.Portrait | DisplayOrientations.Landscape |
                        DisplayOrientations.PortraitFlipped | DisplayOrientations.LandscapeFlipped;
                    break;
            }

            //Update content as its already loaded
            if (args.Item.Content != null)
            {
                //Content loaded already, perform an update instead and exit
                UpdateTabInfo(currentTabIndex);
                return;
            }

            //Lazy load the tabs. Only load when accessed
            UserControl CurrentPanel;
            switch (currentTabIndex)
            {
                case 0:
                    statusVM = ViewModelDispatcher.StatusViewModel;
                    CurrentPanel = new StatusPanel();
                    CurrentPanel.Height = Double.NaN; //Auto height
                    args.Item.Content = CurrentPanel;
                    break;
                case 1:
                    CurrentPanel = new ContactsPanel();
                    CurrentPanel.Height = Double.NaN; //Auto height
                    args.Item.Content = CurrentPanel;
                    break;
                case 2:
                    CurrentPanel = new DialerPanel();
                    CurrentPanel.Height = Double.NaN; //Auto height
                    args.Item.Content = CurrentPanel;
                    break;
                case 3:
                    voicemailVM = ViewModelDispatcher.VoicemailViewModel;
                    CurrentPanel = new VoicemailPanel();
                    CurrentPanel.Height = Double.NaN; //Auto height
                    args.Item.Content = CurrentPanel;
                    break;
                default:
                    break;
            }
        }
Exemplo n.º 13
0
        private void Pivot_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Pivot piv = (Pivot)sender;

            if (piv.SelectedIndex > 0 && sv1.Content == null)
            {
                BuildLicensing();
            }
        }
Exemplo n.º 14
0
        private void PagePivot_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Pivot pivot = (Pivot)sender;

            if (pivot.SelectedIndex == 1)
            {
                PopulateQuotes();
            }
        }
Exemplo n.º 15
0
        private void OnLoaded(object sender, RoutedEventArgs e)
        {
            var scrollViewer = Pivot.GetScrollViewer();

            if (scrollViewer != null)
            {
                scrollViewer.DirectManipulationStarted += ScrollViewer_DirectManipulationStarted;
            }
        }
Exemplo n.º 16
0
 private void SelectDefaultSection(Pivot pivot)
 {
     AppDataModel model = App.Model;
     if (model != null)
     {
         int defaultIndex = (int)model.DefaultHomePage;
         pivot.SelectedIndex = defaultIndex;
     }
 }
Exemplo n.º 17
0
        private async void Pivot_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Pivot     pivot = sender as Pivot;
            TextBlock txt   = this.FindName(string.Format("h{0}", pivot.SelectedIndex)) as TextBlock;

            for (int i = 0; i < pivot.Items.Count; i++)
            {
                TextBlock temp = this.FindName(string.Format("h{0}", i)) as TextBlock;
                temp.Foreground = new SolidColorBrush(Colors.LightGray);
            }
            txt.Foreground = new SolidColorBrush(Colors.White);
            switch (pivot.SelectedIndex)
            {
            case 0:
            {
                if (gv_hot.Items.Count == 0)
                {
                    var temp = await ContentServ.GetContentAsync(71, 1);

                    foreach (var item in temp)
                    {
                        gv_hot.Items.Add(item);
                    }
                }
            }
            break;

            case 1:
            {
                if (gv_star.Items.Count == 0)
                {
                    var temp = await ContentServ.GetContentAsync(137, 1);

                    foreach (var item in temp)
                    {
                        gv_star.Items.Add(item);
                    }
                }
            }
            break;

            case 2:
            {
                if (gv_ka.Items.Count == 0)
                {
                    var temp = await ContentServ.GetContentAsync(131, 1);

                    foreach (var item in temp)
                    {
                        gv_ka.Items.Add(item);
                    }
                }
            }
            break;
            }
        }
Exemplo n.º 18
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            AnchorMin.Read(reader);
            AnchorMax.Read(reader);
            AnchorPosition.Read(reader);
            SizeDelta.Read(reader);
            Pivot.Read(reader);
        }
Exemplo n.º 19
0
        public InstaPage()
        {
            this.InitializeComponent();
            this.Loaded += InstaPage_Loaded;

            Instance = this;
            Layout   = this.MyPivot;

            bmi9.CollectionChanged += Bmi9_CollectionChanged;
        }
Exemplo n.º 20
0
 public ActionResult Edit([Bind(Include = "IrrigationUnitId,Name,IrrigationType,IrrigationEfficiency,Surface,Radius")] Pivot pivot)
 {
     if (ModelState.IsValid)
     {
         db.Entry(pivot).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(pivot));
 }
Exemplo n.º 21
0
    private void InstantiatePivot(Pivot pivot)
    {
        var type = pivot.Type;

        var(x, z) = pivot.Position;
        x        += OFFSET;
        z        += OFFSET;

        _map[x, z] = Instantiate(type, new Vector3(x, 0, z), Quaternion.identity);
    }
Exemplo n.º 22
0
 public void LoadPropertiesFromXml(object control, XmlDocument xml)
 {
     //Настройка видимости и доступности данного грида
     Pivot.PropertyFromXml(xml);
     foreach (PivotGridField field in Pivot.Fields)
     {
         field.GetControlTuner()
         .TuneControl(field, xml);
     }
 }
Exemplo n.º 23
0
        private void OnPivotManipulationStarted(Object sender, System.Windows.Input.ManipulationStartedEventArgs e)
        {
            Pivot pivot = sender as Pivot;

            if (LyricsInfo.IsChangeToLyrics)
            {
                pivot.SelectedIndex         = 1;
                LyricsInfo.IsChangeToLyrics = false;
            }
        }
Exemplo n.º 24
0
        private void PivotSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Pivot pivot = sender as Pivot;

            if (pivot != null && pivot.SelectedIndex >= 0 && pivot.Items != null && pivot.Items.Count > 0)
            {
                PivotItem pivotItem = pivot.Items[pivot.SelectedIndex] as PivotItem;
                new Microsoft.ApplicationInsights.TelemetryClient().TrackEvent(pivotItem.Header.ToString());
            }
        }
Exemplo n.º 25
0
        public override void Read(EndianStream stream)
        {
            base.Read(stream);

            AnchorMin.Read(stream);
            AnchorMax.Read(stream);
            AnchorPosition.Read(stream);
            SizeDelta.Read(stream);
            Pivot.Read(stream);
        }
Exemplo n.º 26
0
 public void addPivot(string name, long parentID, Vector3 position, Vector3 eulerAngles, Quaternion rotation)
 {
     Pivot p = new Pivot();
     p.name = name;
     p.parentID = parentID;
     p.position = position;
     p.eulerAngles = eulerAngles;
     p.rotation = rotation;
     pivots.Add(p);
 }
Exemplo n.º 27
0
        //################################################################################
        #region Public Implementation

        public void Sort(Pivot pivot)
        {
            var low  = 0;
            var high = m_Array.Length - 1;

            int partitionIndex = Partition(pivot, m_Array, low, high);

            Sort(m_Array, low, partitionIndex - 1);
            Sort(m_Array, partitionIndex, high);
        }
Exemplo n.º 28
0
 private async void Pivot_PivotItemLoading(Pivot sender, PivotItemEventArgs args)
 {
     if (args.Item == PreviewPivotItem)
     {
         await TileManager.GenerateTileImagesAsync(MediumTileHost, WideTileHost, TileSettings);
         
         MediumTileImage.Source = await ReadBitmapAsync(new Uri(Constants.MediumTileImageFileUri));                
         WideTileImage.Source = await ReadBitmapAsync(new Uri(Constants.WideTileImageFileUri));
     }
 }
Exemplo n.º 29
0
		private void Pivot_PivotItemLoaded(Pivot sender, PivotItemEventArgs args)
		{
			if (args.Item.Header.ToString().Equals("Movies"))
			{
				changeCommandBarButtonsVisibility(true);
			} else
			{
				changeCommandBarButtonsVisibility(false);
			}
		}
Exemplo n.º 30
0
        private void SelectDefaultSection(Pivot pivot)
        {
            AppDataModel model = App.Model;

            if (model != null)
            {
                int defaultIndex = (int)model.DefaultHomePage;
                pivot.SelectedIndex = defaultIndex;
            }
        }
        private void RenderPivotSelectionPopup()
        {
            Pivot newPivot = (Pivot)EditorGUILayout.EnumPopup(GetContentForPivotSelectionPopup(), _settings.Pivot);

            if (newPivot != _settings.Pivot)
            {
                UndoEx.RecordForToolAction(_settings);
                _settings.Pivot = newPivot;
            }
        }
        // When navigating to a pivotitem, reload the main page and hide the back
        // button
        private void MainPivot_PivotItemLoading(Pivot sender, PivotItemEventArgs args)
        {
            NavigationItem navItem        = (NavigationItem)((((PivotItemEventArgs)args).Item).DataContext);
            Frame          pivotItemFrame = (Frame)(((PivotItem)args.Item).ContentTemplateRoot);

            pivotItemFrame.Navigate(navItem.PageType, navItem);
            pivotItemFrame.BackStack.Clear();

            FireBackStackChangedEvent();
        }
Exemplo n.º 33
0
        public static void Add(this Pivot pivot, string title, Page page)
        {
            PivotItem item = new PivotItem();

            item.Margin  = new Thickness(0);
            item.Header  = title;
            item.Content = page;
            pivot.Items.Add(item);
            //pivot.SelectedIndex = pivot.Items.Count - 1;
        }
Exemplo n.º 34
0
        /// <summary>
        /// Sets a flag indicating that a SelectionChanged event ocurred.
        /// </summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event information.</param>
        private static void Pivot_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
#if WP7
            _selectionChanged = true;
#else
            Pivot     pivot     = (Pivot)sender;
            PivotItem pivotItem = pivot.ItemContainerGenerator.ContainerFromItem(pivot.SelectedItem) as PivotItem;

            if (pivotItem == null)
            {
                return;
            }

            List <FrameworkElement> elements;

            if (!_pivotItemsToElements.TryGetValue(pivotItem, out elements))
            {
                return;
            }

            DependencyObject parent = pivotItem;
            do
            {
                parent = VisualTreeHelper.GetParent(parent);
            } while (parent != null & !(parent is ItemsPresenter));

            if (parent != null)
            {
                ItemsPresenter ip = (ItemsPresenter)parent;

                if (ip.RenderTransform is TranslateTransform)
                {
                    Storyboard storyboard = new Storyboard();
                    foreach (FrameworkElement target in elements)
                    {
                        if (target != null)
                        {
                            if (IsOnScreen(target))
                            {
                                bool fromRight = ((TranslateTransform)ip.RenderTransform).X <= 0;
                                ComposeStoryboard(target, fromRight, ref storyboard);
                            }
                        }
                    }

                    storyboard.Completed += (s1, e1) =>
                    {
                        storyboard.Stop();
                    };

                    storyboard.Begin();
                }
            }
#endif
        }
        private bool MovePivot(Pivot pivot)
        {
            bool result = false;

            if (PivotNext)
            {
                pivot.SelectedIndex = (pivot.SelectedIndex + 1) % pivot.Items.Count;
                result = true;
            }
            else if (PivotLast)
            {
                if (pivot.SelectedIndex == 0)
                {
                    pivot.SelectedIndex = pivot.Items.Count - 1;
                    result = true;
                }
                else
                {
                    pivot.SelectedIndex = pivot.SelectedIndex - 1;
                    result = true;
                }
            }
            else if (!string.IsNullOrWhiteSpace(PivotName))
            {
                var index      = 0;
                var pivotFound = false;

                foreach (var pivotItem in pivot.Items.Cast <PivotItem>())
                {
                    if (pivotItem.Name.ToLowerInvariant().StartsWith(PivotName.ToLowerInvariant()) ||
                        pivotItem.GetValue(AutomationProperties.NameProperty).ToString().ToLowerInvariant().StartsWith(PivotName.ToLowerInvariant()))
                    {
                        pivotFound = true;
                        break;
                    }
                    index++;
                }

                if (pivotFound)
                {
                    pivot.SelectedIndex = index;
                    result = true;
                }
                else
                {
                    SendNotFoundResult(string.Format("PivotCommand: Could not find the Pivot : {0}", PivotName));
                }
            }
            else
            {
                SendNotFoundResult("PivotCommand: Could not find the pivot");
            }

            return(result);
        }
Exemplo n.º 36
0
        public void DoesNotPartitionArraysWithTwoItems()
        {
            // Arrange
            var pivot = new Pivot(new[] { 0, 0 });

            // Act
            var result = pivot.Partition(0, 0, 0);

            // Assert
            Assert.AreEqual(-1, result);
        }
Exemplo n.º 37
0
 private void pvt_PivotItemLoading(Pivot sender, PivotItemEventArgs args)
 {
     if (args.Item == pvt_rooms)
     {
         abtn_addroom.Visibility = Visibility.Visible;
     }
     else
     {
         abtn_addroom.Visibility = Visibility.Collapsed;
     }
 }
Exemplo n.º 38
0
        private async void Pivot_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Pivot     p      = (Pivot)sender;
            PivotItem pi     = (PivotItem)p.SelectedItem;
            string    header = (string)pi.Header;

            if (header != "Journeys")
            {
                await ViewModel.Refresh();
            }
        }
Exemplo n.º 39
0
 public void Read(AssetReader reader)
 {
     Border.Read(reader);
     Pivot.Read(reader);
     OldSize.Read(reader);
     NewSize.Read(reader);
     AdaptiveTilingThreshold = reader.ReadSingle();
     DrawMode       = reader.ReadInt32();
     AdaptiveTiling = reader.ReadBoolean();
     reader.AlignStream();
 }
Exemplo n.º 40
0
 public static void Select(this Pivot pivot, int?index = null)
 {
     if (index >= 0)
     {
         pivot.SelectedIndex = index.Value;
     }
     else
     {
         pivot.SelectedIndex = pivot.Items.Count - 1;
     }
 }
Exemplo n.º 41
0
 public void Read(AssetStream stream)
 {
     Border.Read(stream);
     Pivot.Read(stream);
     OldSize.Read(stream);
     NewSize.Read(stream);
     AdaptiveTilingThreshold = stream.ReadSingle();
     DrawMode       = stream.ReadInt32();
     AdaptiveTiling = stream.ReadBoolean();
     stream.AlignStream(AlignType.Align4);
 }
Exemplo n.º 42
0
        private void approvalsP_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Pivot p = sender as Pivot;

            if (p == null)
            {
                return;
            }

            LoadDataAndSetUI();
        }
 private void OnPivotItemLoading(Pivot sender, PivotItemEventArgs args)
 {
     var commandBar = ((CommandBar) this.BottomAppBar);
     var buttons = commandBar
                     .PrimaryCommands
                     .Union(commandBar.SecondaryCommands)
                     .OfType<PivotItemAppBarButton>();
     foreach (var button in buttons)
     {
         button.Visibility = button.PivotItem == args.Item.Name ? Visibility.Visible : Visibility.Collapsed;
     }
 }
Exemplo n.º 44
0
 private void CreatePivotControl()
 {
     viewToWidgetMap.Clear();
     var toRemove = WidgetsPivot ?? MainPage.WidgetsPivot;
     WidgetsPivot = CreatePivot();
     foreach (var model in GetModelsToBeShown())
     {
         var widget = Activator.CreateInstance(model.Type) as IWpWidget;
         if (widget == null) continue;
         WidgetsPivot.Items.Add(widget.View);
         viewToWidgetMap.Add(widget.View, widget);
     }
     MainPage.LayoutRoot.Children.Remove(toRemove);
     MainPage.LayoutRoot.Children.Add(WidgetsPivot);
 }
Exemplo n.º 45
0
        public HomeScreen ()
        {
            InitializeComponent();

            //~~~init properties
            m_mainPivot = this.MainPivot;

            //~~~init listeners
            BluetoothObserver.Instance.OnReceivedEvent += new Delegate_HandleCommand(this.HandleCommand);

            //~~~init command timer
            m_commandTimer = new DispatcherTimer();
            m_commandTimer.Interval = TimeSpan.FromSeconds(KreyosConstants.SCREEN_INTERVAL);
            m_commandTimer.Tick += UpdateCommands;
            m_commandTimer.Start();
        }
        private void XmlaDataProvider_PrepareDescriptionForField(object sender, Pivot.Core.PrepareDescriptionForFieldEventArgs e)
        {
            if (e.DescriptionType == Telerik.Pivot.Core.DataProviderDescriptionType.Group)
            {
                var desc = e.Description as OlapGroupDescription;

                if (desc != null)
                {
                    desc.GroupComparer = new OlapGroupComparer();

                    foreach (OlapLevelGroupDescription levelGroupDescription in desc.Levels)
                    {
                        levelGroupDescription.GroupComparer = new OlapGroupComparer();
                    }
                }
            }
        }
Exemplo n.º 47
0
        public Vec3 GetPivotPoint(Vec3 center, AABB bounds, Pivot pivot)
        {
            Vec3 vec = center;
            switch (pivot)
            {
                case Pivot.Left:
                    return (vec + ((Vec3)(this.axisX * bounds.min.X)));

                case Pivot.Right:
                    return (vec + ((Vec3)(this.axisX * bounds.max.X)));

                case Pivot.Down:
                    return (vec + ((Vec3)(this.axisY * bounds.min.Y)));

                case Pivot.Up:
                    return (vec + ((Vec3)(this.axisY * bounds.max.Y)));
            }
            return vec;
        }
Exemplo n.º 48
0
Arquivo: Pivot.cs Projeto: tsuixl/Aqua
        static public Vec2 GetPivotOffset(Pivot pivot)
        {
            Vec2 result = Vec2.zero;
            if (pivot == Pivot.Top || pivot == Pivot.Center || pivot == Pivot.Bottom)
                result.x = 0.5f;
            else if (pivot == Pivot.Right || pivot == Pivot.BottomRight || pivot == Pivot.TopRight)
                result.x = 1f;
            else
                result.x = 0f;

            if (pivot == Pivot.Left || pivot == Pivot.Center || pivot == Pivot.Right)
                result.y = 0.5f;
            else if (pivot == Pivot.BottomLeft || pivot == Pivot.Bottom || pivot == Pivot.BottomRight)
                result.y = 1f;
            else
                result.y = 0f;

            return result;
        }
Exemplo n.º 49
0
 private void Pivot_OnPivotItemLoading(Pivot sender, PivotItemEventArgs args)
 {
     if (!ViewModel.Initialized)
         return;
     switch (args.Item.Tag as string)
     {
         case "Details":
             ViewModel.LoadDetails();
             break;
         case "Reviews":
             ViewModel.LoadReviews();
             break;
         case "Recomm":
             ViewModel.LoadRecommendations();
             break;
         case "Related":
             ViewModel.LoadRelatedAnime();
             break;
     }
 }
 /// <summary>
 /// Adds all questions in category to pivot page. Each caterogy will be in seperate pivot.
 /// </summary>
 /// <param name="pivot">Pivot name to which categories should be added.</param>
 public void AddCategoriesToPivot(Pivot pivot)
 {
     pivot.SelectionChanged += (object sender, SelectionChangedEventArgs e) =>
         {
             CategoryPivotItem item = ((CategoryPivotItem)pivot.SelectedItem);
             item.SetAsVisited();
         };
     pivot.Loaded += (object sender, System.Windows.RoutedEventArgs e) =>
         {
             CategoryPivotItem item = ((CategoryPivotItem)pivot.Items[0]);
             if (item!= null)
                 item.SetAsVisited();
         };
     foreach (Category cat in Survey.Categories)
     {
         CategoryPivotItem item = new CategoryPivotItem(cat);
         pivot.Items.Add(item);
     }
     Survey.RefreshQuestionsVisibility();
 }
Exemplo n.º 51
0
        private void InitializePivot()
        {
            Pivot pivotLogin = new Pivot();
            pivotLogin.Foreground = new SolidColorBrush(Color.FromArgb(255, 109, 187, 242));
            StackPanel stpTmp = new StackPanel { Orientation = System.Windows.Controls.Orientation.Horizontal };
            Image image_pivotTitle = new Image
            {
                Source = new BitmapImage(new Uri("/Images/pivotTitle.png", UriKind.Relative)),
                Opacity = 0.5,
            };
            TextBlock txtBlock_pivotTitle = new TextBlock
            {
                Text = "手机QQ",
                Foreground = new SolidColorBrush(Color.FromArgb(255, 147, 209, 239)),
                VerticalAlignment = System.Windows.VerticalAlignment.Center,
                FontWeight = FontWeights.Light,
            };
            stpTmp.Children.Add(image_pivotTitle);
            stpTmp.Children.Add(txtBlock_pivotTitle);
            pivotLogin.Title = stpTmp;

            PivotItem itemLogin = new PivotItem
            {
                Header = "登陆",
                Padding = new Thickness(10, 0, 10, 0),
            };
            PivotItem itemSetting = new PivotItem
            {
                Header = "设置",
                Padding = new Thickness(10, 0, 10, 0)
            };
            itemLogin.Content = InitializeLoginItem();
            itemSetting.Content = InitializeSettingItem();
            pivotLogin.Items.Add(itemLogin);
            pivotLogin.Items.Add(itemSetting);
            pivotLogin.SelectionChanged += pivotLogion_SelectionChanged;

            LayoutRoot.Children.Add(pivotLogin);
        }
Exemplo n.º 52
0
        public Vec3 GetPivotPoint(Vec3 center, AABB bounds, Pivot pivot)
        {
            Vec3 vec = center;
            switch (pivot)
            {
            case Pivot.Left:
                vec += this.axisX * bounds.min.X;
                break;

            case Pivot.Right:
                vec += this.axisX * bounds.max.X;
                break;

            case Pivot.Down:
                vec += this.axisY * bounds.min.Y;
                break;

            case Pivot.Up:
                vec += this.axisY * bounds.max.Y;
                break;
            }
            return vec;
        }
        public SummaryMainClass()
        {
            inputSetting = (Settings)xobj;
            string msg = null;
            if (inputSetting != null)
            {
                if (!System.IO.File.Exists(inputSetting.DataPath)) msg = msg + "Data Path is invalid!";
                if (!System.IO.File.Exists(inputSetting.SpecPath)) msg = msg + "Spec Path is invalid!";
                if (!(msg == null)) sl.showForm(msg);
                if (System.IO.File.Exists(inputSetting.DataPath))
                {
                    dt = new DataTable();
                    sdt = new DataTable();
                    dt = ExcelLayer.GetDataTable(inputSetting.DataPath);
                    sdt = ExcelLayer.GetDataTable(inputSetting.SpecPath);

                    if (dt != null) ChangeDataTable(ref dt);
                    if (sdt != null) ChangeDataTable(ref sdt);

                    pvt = new Pivot(dt, sdt);
                }
            }
        }
Exemplo n.º 54
0
        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int rowIndex = Int32.Parse(e.CommandArgument.ToString());//获取点击了第几行
            int posID = Int32.Parse(grVPositionManage.DataKeys[rowIndex].Values[0].ToString());

            if (e.CommandName == "DimSetting")
            {
                Response.Redirect("~/System/DimensionSet.aspx?mode=0&posid=" + posID.ToString());
            }
            if (e.CommandName.Equals("Export") || e.CommandName.Equals("ExportNewData"))//答题信息导出 or 数据导出
            {
                PositionBLL temp = new PositionBLL();
                DimensionBLL dBll = new DimensionBLL();

                DataSet dimDS = dBll.GetDimensionAll();
                DataSet dsAll = new DataSet();

                for (int i = 0; i < dimDS.Tables[0].Rows.Count; i++)
                {
                    int dimID = Int32.Parse(dimDS.Tables[0].Rows[i][0].ToString());
                    DataSet dsa =  temp.GetExportDSIncAllDim(posID,dimID);
                    dsa.Tables[0].TableName = dBll.GetDimension(dimID.ToString()).Dimnm;
                    dsAll.Tables.Add(dsa.Tables[0].Copy());
                }

                //2012.3.14,岗位导出时删除无关维度表 begin.
                for (int i = dsAll.Tables.Count - 1; i >= 0; i--)
                {
                    if (dsAll.Tables[i].Rows.Count < 1)
                    {
                        dsAll.Tables.Remove(dsAll.Tables[i]);
                    }
                }
                dsAll.AcceptChanges();
                //2012.3.14,岗位导出时删除无关维度表 end.

                //新的导出格式---数据导出
                DataSet dsPivot = new DataSet();
                if (e.CommandName.Equals("ExportNewData"))
                {
                    //开始进行pivot
                    string activityName = string.Empty;
                    string testerName = string.Empty;

                    TesterInfoBLL tbll = new TesterInfoBLL();
                    ActivityBLL abll = new ActivityBLL();
                    GuidBLL gbll = new GuidBLL();

                    foreach (DataTable t in dsAll.Tables)
                    {
                        Pivot p = new Pivot(t);
                        DataTable dt = p.PivotData("序列号", "原始得分", AggregateFunction.Sum, "题目编号");
                        p = null;
                        dt.TableName = t.TableName;
                        dt.Columns.Add("项目名称").SetOrdinal(0);
                        dt.Columns.Add("姓名").SetOrdinal(1);

                        foreach (DataRow row in dt.Rows)
                        {
                            string guid = row["序列号"].ToString();
                            row["项目名称"] = abll.GetActivityNM(gbll.GetActivityId(guid));
                            row["姓名"] = tbll.GetUserNameByGUID(guid);
                        }
                        dsPivot.Tables.Add(dt);
                    }
                    //pivot结束
                }
                string filePath = Server.MapPath("../userfiles") + @"\position_" + DateTime.Now.ToString("yyyyMMdd_HH_mm_ss") + ".xls";
                string fileName = Path.GetFileName(filePath);

                if (e.CommandName.Equals("Export"))//原始格式--答题信息导出
                {
                    //2013.10.22 add by conghui for export issue begin.
                    foreach (DataTable dt in dsAll.Tables)
                    {
                        for (int i = 0; i < dt.Columns.Count; i++)
                        {
                            for (int j = 0; j < dt.Rows.Count; j++)
                            {
                                if (dt.Rows[j][i] == DBNull.Value || dt.Rows[j][i] == null)//如果单元格为空
                                {
                                    if (i == 2)//第二列是日期列
                                    {
                                        dt.Rows[j][i] = "1900-1-1";
                                    }
                                    else
                                    {
                                        dt.Rows[j][i] = "";
                                    }
                                }
                                else//单元格非空
                                {
                                    if (i == 2)//将日期强制转化为字符串
                                    {
                                        dt.Rows[j][i] = dt.Rows[j][i].ToString();
                                    }
                                }
                            }
                        }
                    }
                    //2013.10.22 add by conghui for export issue end.

                    ExcelLibrary.DataSetHelper.CreateWorkbook(filePath, dsAll);
                }
                else if (e.CommandName.Equals("ExportNewData"))//新的格式--答题数据导出
                {
                    ExcelLibrary.DataSetHelper.CreateWorkbook(filePath, dsPivot);
                }

                Stream stream = null;
                stream = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read);
                long bytesToRead = stream.Length;
                Response.Clear();
                Response.ContentType = "application/ms-excel";
                Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName);

                while (bytesToRead > 0)
                {
                    if (Response.IsClientConnected)
                    {
                        byte[] buffer = new Byte[10000];
                        int length = stream.Read(buffer, 0, 10000);
                        Response.OutputStream.Write(buffer, 0, length);
                        Response.Flush();
                        bytesToRead = bytesToRead - length;
                    }
                    else
                    {
                        bytesToRead = -1;
                    }
                }
            }
        }
Exemplo n.º 55
0
 public Vec3 GetPivotPoint(Pivot pivot)
 {
     AABB bounds;
     if (this.IsLoaded)
     {
         bounds = this.LocalBounds;
     }
     else
     {
         bounds = default(AABB);
     }
     return this.Axis.GetPivotPoint(this.Position, bounds, pivot);
 }
Exemplo n.º 56
0
        //public MagicPivotViewModel(string pName, string selName, Pivot sp)
        public MagicPivotViewModel(Category selectedCategory, Pivot sp)
        {
            TabIndex = 0;
            Columns = new List<ColumnContent>();

            //this.ParentName = pName;
            //this.SelectedName = selName;
            this.selectedCategory = selectedCategory;

            myPivot = sp;

            Debug.WriteLine("Current category is " + this.selectedCategory.Name + " who's parent is " + this.selectedCategory.Parent.Name);
            //Debug.WriteLine("Made a new MagicPivot View Model with parent = " + pName + " & cur = " + selName);

            //force all data to update
            //if (ParentName != "" && Columns.Count == 0)
            if (Columns.Count == 0)
                UpdateData();
        }
Exemplo n.º 57
0
 private void Pivot_OnPivotItemLoading(Pivot sender, PivotItemEventArgs args)
 {
     ((args.Item.Content as RecommendationsViewModel.XPivotItem).Content as RecommendationItemViewModel).PopulateData();
 }
 public PivotBrowserController(Pivot pivotController)
 {
     this.PivotController = pivotController;
     _browserList = new Dictionary<int, PivotBrowser>();
 }
Exemplo n.º 59
0
 private static Pivot CreatePivot()
 {
     var pivot = new Pivot() {Foreground = new SolidColorBrush(Color.FromArgb(0xff, 0xf2, 0x50, 0x00))};
     pivot.Title = new TextBlock() {Foreground = new SolidColorBrush(Colors.White), Text = "SMEEDEE"};
     return pivot;
 }
Exemplo n.º 60
0
 /// <summary>
 /// Sets the parent pivot of the specified dependency object.
 /// </summary>
 /// <param name="obj">The dependency object.</param>
 /// <param name="value">The pivot.</param>
 private static void SetParentPivot(DependencyObject obj, Pivot value)
 {
     obj.SetValue(ParentPivotProperty, value);
 }