Exemplo n.º 1
0
 protected virtual void OnFragmentNavigation(FragmentNavigationEventArgs args)
 {
     if (FragmentNavigation != null)
     {
         FragmentNavigation(this, args);
     }
 }
Exemplo n.º 2
0
        public void OnFragmentNavigation(FragmentNavigationEventArgs e)
        {
            int id = int.Parse(e.Fragment);

            tabTop.Links.Clear();
            tabTop.Links.Add(new Link {
                DisplayName = "General", Source = new Uri("/ServerMode/Contest/Problem/General.xaml#" + id, UriKind.Relative)
            });
            tabTop.Links.Add(new Link {
                DisplayName = "Content", Source = new Uri("/ServerMode/Contest/Problem/Content.xaml#" + id, UriKind.Relative)
            });
            tabTop.Links.Add(new Link {
                DisplayName = "Test cases", Source = new Uri("/ServerMode/Contest/Problem/TestCases.xaml#" + id, UriKind.Relative)
            });
            tabTop.Links.Add(new Link {
                DisplayName = "SPJ", Source = new Uri("/ServerMode/Contest/Problem/Code.xaml#field=Spj&id=" + id, UriKind.Relative)
            });
            tabTop.Links.Add(new Link {
                DisplayName = "Range validator", Source = new Uri("/ServerMode/Contest/Problem/Code.xaml#field=Validator&id=" + id, UriKind.Relative)
            });
            tabTop.Links.Add(new Link {
                DisplayName = "Std source", Source = new Uri("/ServerMode/Contest/Problem/Code.xaml#field=Std&id=" + id, UriKind.Relative)
            });
            tabTop.SelectedSource = new Uri("/ServerMode/Contest/Problem/General.xaml#" + id, UriKind.Relative);
        }
Exemplo n.º 3
0
        private void OnSourceChanged(Uri oldValue, Uri newValue)
        {
            // if resetting source or old source equals new, don't do anything
            if (this.isResetSource || newValue != null && newValue.Equals(oldValue))
            {
                return;
            }

            // handle fragment navigation
            string newFragment        = null;
            var    oldValueNoFragment = NavigationHelper.RemoveFragment(oldValue);
            var    newValueNoFragment = NavigationHelper.RemoveFragment(newValue, out newFragment);

            if (newValueNoFragment != null && newValueNoFragment.Equals(oldValueNoFragment))
            {
                // fragment navigation
                var args = new FragmentNavigationEventArgs {
                    Fragment = newFragment
                };

                OnFragmentNavigation(this.Content as IContent, args);
            }
            else
            {
                var navType = this.isNavigatingHistory ? NavigationType.Back : NavigationType.New;

                // only invoke CanNavigate for new navigation
                if (!this.isNavigatingHistory && !CanNavigate(oldValue, newValue, navType))
                {
                    return;
                }

                Navigate(oldValue, newValue, navType);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Called when navigation to a content fragment begins.
        /// </summary>
        /// <param name="e">An object that contains the navigation data.</param>
        public void OnFragmentNavigation(FragmentNavigationEventArgs e)
        {
            FragmentManager fm            = new FragmentManager(e.Fragment);
            string          testCaseIdStr = fm.Get("id");

            if (!string.IsNullOrEmpty(testCaseIdStr))
            {
                int testCaseId = int.Parse(testCaseIdStr);
                this.AssociateTestViewModel = new AssociateTestViewModel(testCaseId);
            }

            string suiteId = fm.Get("suiteId");

            if (!string.IsNullOrEmpty(suiteId))
            {
                this.AssociateTestViewModel.TestSuiteId = int.Parse(suiteId);
            }
            string createNew = fm.Get("createNew");

            if (!string.IsNullOrEmpty(createNew))
            {
                this.AssociateTestViewModel.CreateNew = bool.Parse(createNew);
            }
            string duplicate = fm.Get("duplicate");

            if (!string.IsNullOrEmpty(duplicate))
            {
                this.AssociateTestViewModel.Duplicate = bool.Parse(duplicate);
            }

            this.DataContext = this.AssociateTestViewModel;
            this.cbTestType.SelectedIndex = 0;
        }
Exemplo n.º 5
0
 /// <summary>
 /// Called when navigation to a content fragment begins.
 /// </summary>
 /// <param name="e">An object that contains the navigation data.</param>
 public void OnFragmentNavigation(FragmentNavigationEventArgs e)
 {
     if (FragmentNavigation != null)
     {
         FragmentNavigation.Invoke(this, e);
     }
 }
Exemplo n.º 6
0
 void PART_Frame_FragmentNavigation(object sender, FragmentNavigationEventArgs e)
 {
     if (FragmentNavigation != null)
     {
         FragmentNavigation(this, e);
     }
 }
Exemplo n.º 7
0
        private void OnSourceChanged(Uri oldValue, Uri newValue)
        {
            if (isResetSource || newValue != null && newValue.Equals(oldValue))
            {
                return;
            }

            string newFragment        = null;
            var    oldValueNoFragment = NavigationHelper.RemoveFragment(oldValue);
            var    newValueNoFragment = NavigationHelper.RemoveFragment(newValue, out newFragment);

            if (newValueNoFragment != null && newValueNoFragment.Equals(oldValueNoFragment))
            {
                var args = new FragmentNavigationEventArgs {
                    Fragment = newFragment
                };

                OnFragmentNavigation(Content as IContent, args);
            }
            else
            {
                var navType = isNavigatingHistory ? NavigationType.Back : NavigationType.New;

                if (!isNavigatingHistory && !CanNavigate(oldValue, newValue, navType))
                {
                    return;
                }

                Navigate(oldValue, newValue, navType);
            }
        }
Exemplo n.º 8
0
        public void OnFragmentNavigation(FragmentNavigationEventArgs e)
        {
            //occures after navigateTo method
            //read passed data from e.Fragment
            //deserialize data!
            OperationState = JsonConvert.DeserializeObject <OperationState>(e.Fragment);

            if (OperationState.Operation == Operation.Modified)
            {
                ManipulateForm();
                DisableControl();
                FillDomainsCombo(OperationState.Data.DomainName);
            }

            if (OperationState.Operation == Operation.Add)
            {
                if (string.IsNullOrEmpty(OperationState.Data.DomainName))
                {
                    ResetForm();
                    FillFileName();
                    FillDomainsCombo(null);
                }

                EnableControl();
                //FillFileAddress(DomainList.SelectionBoxItem.ToString());
            }
        }
Exemplo n.º 9
0
 public void OnFragmentNavigation(FragmentNavigationEventArgs e)
 {
     if (!string.IsNullOrEmpty(e.Fragment))
     {
         this.movieViewModelId = Convert.ToInt32(e.Fragment);
     }
 }
Exemplo n.º 10
0
        private void SetContent(Uri newSource, NavigationType navigationType, object newContent, bool contentIsError)
        {
            var oldContent = this.Content;

            // assign content
            this.Content = newContent;

            // do not raise navigated event when error
            if (!contentIsError)
            {
                var args = new NavigationEventArgs(this, newSource, navigationType, newContent);
                OnNavigated(oldContent, newContent, args);

                // and raise optional fragment navigation events
                string fragment;
                NavigationHelper.RemoveFragment(newSource, out fragment);
                if (fragment != null)
                {
                    // fragment navigation
                    var fragmentArgs = new FragmentNavigationEventArgs
                    {
                        Fragment = fragment
                    };

                    OnFragmentNavigation(newContent, fragmentArgs);
                }
            }
        }
        /// <summary>
        /// Called when navigation to a content fragment begins.
        /// </summary>
        /// <param name="e">An object that contains the navigation data.</param>
        public void OnFragmentNavigation(FragmentNavigationEventArgs e)
        {
            isInitialized = false;
            FragmentManager fm = new FragmentManager(e.Fragment);

            this.TestCaseId  = int.Parse(fm.Fragments["id"]);
            this.TestSuiteId = int.Parse(fm.Fragments["suiteId"]);
        }
Exemplo n.º 12
0
        /// <summary>
        /// Raises the fragment navigation event.
        /// </summary>
        /// <param name="content">The content.</param>
        /// <param name="e">The fragment navigation event arguments.</param>
        private void OnFragmentNavigation(IContent content, FragmentNavigationEventArgs e)
        {
            // invoke optional IContent.OnFragmentNavigation
            content?.OnFragmentNavigation(e);

            // raise the FragmentNavigation event
            FragmentNavigation?.Invoke(this, e);
        }
Exemplo n.º 13
0
        private void App_FragmentNavigation(object sender, FragmentNavigationEventArgs e)
        {
            String temp = this.tag;

            this.tag = APPLICATION;
            this.CurrentFolder("App_FragmentNavigation", "lifecyclelogs");
            this.Console("App_FragmentNavigation");
            this.tag = temp;
        }
Exemplo n.º 14
0
        public void OnFragmentNavigation(FragmentNavigationEventArgs e)
        {
            var fragment = Fragment.FromString(e.Fragment);

            if (fragment != null && IsRefreshRequested(fragment))
            {
                _viewModel.Refresh();
            }
        }
Exemplo n.º 15
0
 /// <summary>
 /// Handles the <see cref="E:FragmentNavigation"/> event.
 /// </summary>
 /// <param name="e">The <see cref="FirstFloor.ModernUI.Windows.Navigation.FragmentNavigationEventArgs"/> instance containing the event data.</param>
 public void OnFragmentNavigation(FragmentNavigationEventArgs e)
 {
     Debug.WriteLine("ModernUserControl - OnFragmentNavigation");
     if (FragmentNavigation != null)
     {
         FragmentNavigation(this, e);
         Debug.WriteLine("ModernUserControl - OnFragmentNavigation event called");
     }
 }
Exemplo n.º 16
0
    void frame_FragmentNavigation(object sender, FragmentNavigationEventArgs e)
    {
        var content = GetIContent(_frame.Content);

        if (content != null)
        {
            content.OnFragmentNavigation(e);
        }
    }
Exemplo n.º 17
0
        void frame_FragmentNavigation(object sender, FragmentNavigationEventArgs e)
        {
            var handler = this.FragmentNavigation;

            if (handler != null)
            {
                handler(sender, e);
            }
        }
Exemplo n.º 18
0
        public void OnFragmentNavigation(FragmentNavigationEventArgs e)
        {
            contestID = int.Parse(e.Fragment);
            var desc = App.Server.GetContest(contestID).Description;

            using (MemoryStream mem = new MemoryStream(Encoding.UTF8.GetBytes(desc)))
            {
                new TextRange(richMain.Document.ContentStart, richMain.Document.ContentEnd).Load(mem, DataFormats.Rtf);
            }
        }
Exemplo n.º 19
0
        /// <summary>
        /// Called when navigation to a content fragment begins.
        /// </summary>
        /// <param name="e">An object that contains the navigation data.</param>
        public void OnFragmentNavigation(FragmentNavigationEventArgs e)
        {
            FragmentManager fm         = new FragmentManager(e.Fragment);
            string          suiteIdStr = fm.Get("suiteId");

            if (!string.IsNullOrEmpty(suiteIdStr))
            {
                this.suiteId = int.Parse(suiteIdStr);
            }
        }
Exemplo n.º 20
0
        public void OnFragmentNavigation(FragmentNavigationEventArgs e)
        {
            id = int.Parse(e.Fragment);
            var content = App.Server.GetProblem(id).Content;

            using (MemoryStream mem = new MemoryStream(Encoding.UTF8.GetBytes(content)))
            {
                new TextRange(richMain.Document.ContentStart, richMain.Document.ContentEnd).Load(mem, DataFormats.Rtf);
            }
        }
Exemplo n.º 21
0
        /// <summary>
        /// Called when navigation to a content fragment begins.
        /// </summary>
        /// <param name="e">An object that contains the navigation data.</param>
        public void OnFragmentNavigation(FragmentNavigationEventArgs e)
        {
            FragmentManager fm = new FragmentManager(e.Fragment);
            string          skipAutoLoadStr = fm.Get("skipAutoLoad");

            if (!string.IsNullOrEmpty(skipAutoLoadStr))
            {
                this.skipAutoLoad = bool.Parse(skipAutoLoadStr);
            }
        }
Exemplo n.º 22
0
        protected override void OnFragmentNavigation(FragmentNavigationEventArgs e)
        {
            base.OnFragmentNavigation(e);

            if (this.DataContext != null && this.DataContext is InteractionViewModelBase)
            {
                var vm = (InteractionViewModelBase)this.DataContext;
                vm.PageState = this.State;
                vm.OnFragmentNavigation(e);
            }
        }
Exemplo n.º 23
0
        private void OnFragmentNavigation(IContent content, FragmentNavigationEventArgs e)
        {
            if (content != null)
            {
                content.OnFragmentNavigation(e);
            }

            if (FragmentNavigation != null)
            {
                FragmentNavigation(this, e);
            }
        }
Exemplo n.º 24
0
        public void OnFragmentNavigation(FragmentNavigationEventArgs e)
        {
            int id = int.Parse(e.Fragment);

            Entity.Contest contest    = App.Server.GetContest(id);
            var            wholeRange = new TextRange(txtDescription.Document.ContentStart, txtDescription.Document.ContentEnd);

            using (MemoryStream mem = new MemoryStream(Encoding.UTF8.GetBytes(contest.Description)))
            {
                wholeRange.Load(mem, DataFormats.Rtf);
            }
        }
Exemplo n.º 25
0
        //<SnippetFEBringIntoView>
        void browserFrame_FragmentNavigation(object sender, FragmentNavigationEventArgs e)
        {
            object content = ((ContentControl)e.Navigator).Content;
            FrameworkContentElement fragmentElement = LogicalTreeHelper.FindLogicalNode((DependencyObject)content, e.Fragment) as FrameworkContentElement;

            if (fragmentElement != null)
            {
                // Go to fragment if found
                fragmentElement.BringIntoView();
            }
            e.Handled = true;
        }
Exemplo n.º 26
0
        public void OnFragmentNavigation(FragmentNavigationEventArgs e)
        {
            problemID = int.Parse(e.Fragment);
            var problem = App.Server.GetProblem(problemID);

            txtTitle.Text = problem.Title;
            var wholePage = new TextRange(txtContent.Document.ContentStart, txtContent.Document.ContentEnd);

            using (MemoryStream mem = new MemoryStream(Encoding.UTF8.GetBytes(problem.Content)))
            {
                wholePage.Load(mem, DataFormats.Rtf);
            }
        }
Exemplo n.º 27
0
        private void OnFragmentNavigation(IContent content, FragmentNavigationEventArgs e)
        {
            // invoke optional IContent.OnFragmentNavigation
            if (content != null)
            {
                content.OnFragmentNavigation(e);
            }

            // raise the FragmentNavigation event
            if (FragmentNavigation != null)
            {
                FragmentNavigation(this, e);
            }
        }
Exemplo n.º 28
0
        // Token: 0x06002D44 RID: 11588 RVA: 0x000CC554 File Offset: 0x000CA754
        internal static void FragmentHandler(object sender, FragmentNavigationEventArgs e)
        {
            NavigationService navigationService = sender as NavigationService;

            if (navigationService != null)
            {
                string         fragment      = e.Fragment;
                IFixedNavigate fixedNavigate = navigationService.Content as IFixedNavigate;
                if (fixedNavigate != null)
                {
                    fixedNavigate.NavigateAsync(e.Fragment);
                    e.Handled = true;
                }
            }
        }
Exemplo n.º 29
0
        private void OnSourceChanged([CanBeNull] Uri oldValue, [CanBeNull] Uri newValue)
        {
            var immediate = Content as IImmediateContent;

            try {
                if (newValue != null && oldValue?.SamePath(newValue) == true && immediate?.ImmediateChange(newValue) == true)
                {
                    return;
                }
            } catch (Exception e) {
                Logging.Error(e);
            }

            // if resetting source or old source equals new, don’t do anything
            if (_isResetSource || newValue != null && newValue.Equals(oldValue))
            {
                return;
            }

            // handle fragment navigation
            string newFragment;
            var    oldValueNoFragment = NavigationHelper.RemoveFragment(oldValue);
            var    newValueNoFragment = NavigationHelper.RemoveFragment(newValue, out newFragment);

            if (newValueNoFragment != null && newValueNoFragment.Equals(oldValueNoFragment))
            {
                // fragment navigation
                var args = new FragmentNavigationEventArgs {
                    Fragment = newFragment
                };

                OnFragmentNavigation(Content as IContent, args);
            }
            else
            {
                var navType = _isNavigatingHistory ? NavigationType.Back :
                              _isNavigatingFuture ? NavigationType.Forward :
                              NavigationType.New;

                // only invoke CanNavigate for new navigation
                if (!_isNavigatingHistory && !_isNavigatingFuture && !CanNavigate(oldValue, newValue, navType))
                {
                    return;
                }

                Navigate(oldValue, newValue, navType);
            }
        }
Exemplo n.º 30
0
        /// <summary>
        /// Initializes the URL parameters.
        /// </summary>
        /// <param name="e">The <see cref="FragmentNavigationEventArgs"/> instance containing the event data.</param>
        private void InitializeUrlParameters(FragmentNavigationEventArgs e)
        {
            FragmentManager fm = new FragmentManager(e.Fragment);
            string          loadTestCasesStr = fm.Get("loadTestCases");

            if (!string.IsNullOrEmpty(loadTestCasesStr))
            {
                this.loadTestCases = bool.Parse(loadTestCasesStr);
            }
            string loadSpecificTestCasesStr = fm.Get("loadSpecificTestCases");

            if (!string.IsNullOrEmpty(loadSpecificTestCasesStr))
            {
                this.loadSpecificTestCases = bool.Parse(loadSpecificTestCasesStr);
            }
        }
Exemplo n.º 31
0
        private void OnFragmentNavigation(IContent content, FragmentNavigationEventArgs e)
        {
            // invoke optional IContent.OnFragmentNavigation
            if (content != null) {
                content.OnFragmentNavigation(e);
            }

            // raise the FragmentNavigation event
            if (FragmentNavigation != null) {
                FragmentNavigation(this, e);
            }
        }
Exemplo n.º 32
0
        private void OnSourceChanged(Uri oldValue, Uri newValue)
        {
            // if resetting source or old source equals new, don't do anything
            if (this.isResetSource || newValue != null && newValue.Equals(oldValue)) {
                return;
            }

            // handle fragment navigation
            string newFragment = null;
            var oldValueNoFragment = NavigationHelper.RemoveFragment(oldValue);
            var newValueNoFragment = NavigationHelper.RemoveFragment(newValue, out newFragment);

            if (newValueNoFragment != null && newValueNoFragment.Equals(oldValueNoFragment)) {
                // fragment navigation
                var args = new FragmentNavigationEventArgs {
                    Fragment = newFragment
                };

                OnFragmentNavigation(this.Content as IContent, args);
            }
            else {
                var navType = this.isNavigatingHistory ? NavigationType.Back : NavigationType.New;

                // only invoke CanNavigate for new navigation
                if (!this.isNavigatingHistory && !CanNavigate(oldValue, newValue, navType)) {
                    return;
                }

                Navigate(oldValue, newValue, navType);
            }
        }
Exemplo n.º 33
0
        private void SetContent(Uri newSource, NavigationType navigationType, object newContent, bool contentIsError)
        {
            var oldContent = this.Content as IContent;

            // assign content
            this.Content = newContent;

            // do not raise navigated event when error
            if (!contentIsError) {
                var args = new NavigationEventArgs {
                    Frame = this,
                    Source = newSource,
                    Content = newContent,
                    NavigationType = navigationType
                };

                OnNavigated(oldContent, newContent as IContent, args);
            }

            // set IsLoadingContent to false
            SetValue(IsLoadingContentPropertyKey, false);

            if (!contentIsError) {
                // and raise optional fragment navigation events
                string fragment;
                NavigationHelper.RemoveFragment(newSource, out fragment);
                if (fragment != null) {
                    // fragment navigation
                    var fragmentArgs = new FragmentNavigationEventArgs {
                        Fragment = fragment
                    };

                    OnFragmentNavigation(newContent as IContent, fragmentArgs);
                }
            }
        }