Exemplo n.º 1
0
		public AppDelegate ()
		{
			PrepareCache ();
			ExtractImages ();
			controller = new MonodocDocumentController ();
			
			// Some UI feature we use rely on Lion, so special case it
			try {
				var version = new NSDictionary ("/System/Library/CoreServices/SystemVersion.plist");
				isOnLion = version.ObjectForKey (new NSString ("ProductVersion")).ToString ().StartsWith ("10.7");
			} catch {}
			
			// Load documentation
			Root = RootTree.LoadTree (null);
			
			var macDocPath = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData), "macdoc");
			if (!Directory.Exists (macDocPath))
				Directory.CreateDirectory (macDocPath);
			IndexUpdateManager = new IndexUpdateManager (Root.HelpSources.Cast<HelpSource> ().Select (hs => Path.Combine (hs.BaseFilePath, hs.Name + ".zip")).Where (File.Exists),
			                                             macDocPath);
			BookmarkManager = new BookmarkManager (macDocPath);
			AppleDocHandler = new AppleDocHandler ("/Library/Frameworks/Mono.framework/Versions/Current/etc/");
			
			// Configure the documentation rendering.
			SettingsHandler.Settings.EnableEditing = false;
			SettingsHandler.Settings.preferred_font_size = 200;
			HelpSource.use_css = true;
		}
Exemplo n.º 2
0
		static void Main(string[] args)
		{
			var initialUrl = string.Empty;
			var docSources = new List<string> ();
			new OptionSet {
				{ "url=|u=", u => initialUrl = u },
				{ "docdir=", dir => docSources.Add (dir) },
			}.Parse (args);

			if (initialUrl.StartsWith ("mdoc://")) {
				initialUrl = initialUrl.Substring ("mdoc://".Length); // Remove leading scheme
				initialUrl = initialUrl.Substring (0, initialUrl.Length - 1); // Remove trailing '/'
				initialUrl = Uri.UnescapeDataString (initialUrl); // Unescape URL
			}

			// Don't crash if any of these steps fails
			try {
				PrepareCache ();
				SetupLogging ();
				ExtractImages ();
			} catch (Exception e) {
				Console.WriteLine ("Non-fatal exception during initialization: {0}", e);
			}

			// Load documentation
			Directory.SetCurrentDirectory (Path.GetDirectoryName (typeof (Program).Assembly.Location));
			Root = RootTree.LoadTree (null);
			foreach (var dir in docSources)
				Root.AddSource (dir);
			if (Directory.Exists (externalMonodocPath))
				Root.AddSource (externalMonodocPath);
			
			var winDocPath = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData), "WinDoc");
			if (!Directory.Exists (winDocPath))
				Directory.CreateDirectory (winDocPath);
			IndexUpdateManager = new IndexUpdateManager (Root.HelpSources
															.Cast<HelpSource> ()
															.Select (hs => Path.Combine (hs.BaseFilePath, hs.Name + ".zip"))
															.Where (File.Exists),
			                                             winDocPath);
			BookmarkManager = new BookmarkManager (winDocPath);
			
			// Configure the documentation rendering.
			SettingsHandler.Settings.EnableEditing = false;
			SettingsHandler.Settings.preferred_font_size = 200;
			HelpSource.use_css = true;

			Application.ApplicationExit += (s, e) => BookmarkManager.SaveBookmarks ();
			Application.EnableVisualStyles();
			Application.SetCompatibleTextRenderingDefault (false);
			Application.Run(new MainWindow (initialUrl));
		}
Exemplo n.º 3
0
 public Client(OperaLink.Configs conf)
 {
     conf_ = conf;
       typeds_ = new TypedHistoryManager();
       ses_ = new SearchEngineManager();
       sds_ = new SpeedDialManager();
       notes_ = new NoteManager();
       bms_ = new BookmarkManager();
       xml_settings_ = new XmlWriterSettings
       {
     Encoding = System.Text.Encoding.UTF8,
     NewLineOnAttributes = false,
       };
       sync_state_ = 0;
       short_interval_ = 60;
       long_interval_ = 120;
       token_ = "";
       LastStatus = "";
       enc_ = Encoding.GetEncoding("utf-8");
 }
Exemplo n.º 4
0
		static void Main(string[] args)
		{
			var initialUrl = string.Empty;
			var docSources = new List<string> ();
			new OptionSet {
				{ "url=|u=", u => initialUrl = u },
				{ "docdir=", dir => docSources.Add (dir) },
			}.Parse (args);

			PrepareCache ();
			ExtractImages ();
			
			// Load documentation
			Root = RootTree.LoadTree (null);
			foreach (var dir in docSources)
				Root.AddSource (dir);
			
			var winDocPath = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData), "WinDoc");
			if (!Directory.Exists (winDocPath))
				Directory.CreateDirectory (winDocPath);
			IndexUpdateManager = new IndexUpdateManager (Root.HelpSources
															.Cast<HelpSource> ()
															.Select (hs => Path.Combine (hs.BaseFilePath, hs.Name + ".zip"))
															.Where (File.Exists),
			                                             winDocPath);
			BookmarkManager = new BookmarkManager (winDocPath);
			
			// Configure the documentation rendering.
			SettingsHandler.Settings.EnableEditing = false;
			SettingsHandler.Settings.preferred_font_size = 200;
			HelpSource.use_css = true;

			Application.ApplicationExit += (s, e) => BookmarkManager.SaveBookmarks ();
			Application.EnableVisualStyles();
			Application.SetCompatibleTextRenderingDefault (false);
			Application.Run(new MainWindow (initialUrl));
		}
 sealed internal override void InternalCancel(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
 {
     if (executor.TryGetPendingOperation(instance, out AsyncOperationContext asyncContext))
     {
         AsyncCodeActivityContext context = new AsyncCodeActivityContext(asyncContext, instance, executor);
         try
         {
             asyncContext.HasCalledAsyncCodeActivityCancel = true;
             Cancel(context);
         }
         finally
         {
             context.Dispose();
         }
     }
 }
        internal sealed override void InternalExecute(System.Activities.ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
        {
            CodeActivityContext context = executor.CodeActivityContextPool.Acquire();

            try
            {
                context.Initialize(instance, executor);
                TResult local = this.Execute(context);
                base.Result.Set(context, local);
            }
            finally
            {
                context.Dispose();
                executor.CodeActivityContextPool.Release(context);
            }
        }
Exemplo n.º 7
0
 void HandleOnConference(BookmarkManager manager, BookmarkConference conference)
 {
     QApplication.Invoke(delegate {
         Emit.LayoutChanged();
     });
 }
Exemplo n.º 8
0
		public AppDelegate ()
		{
			PrepareCache ();
			ExtractImages ();
			controller = new MonodocDocumentController ();
			
			// Some UI feature we use rely on Lion or better, so special case it
			try {
				var version = new NSDictionary ("/System/Library/CoreServices/SystemVersion.plist");
				var osxVersion = Version.Parse (version.ObjectForKey (new NSString ("ProductVersion")).ToString ());
				isOnLion = osxVersion.Major == 10 && osxVersion.Minor >= 7;
			} catch {}
			
			// Load documentation
			var args = Environment.GetCommandLineArgs ();
			IEnumerable<string> extraDocs = null, extraUncompiledDocs = null;
			if (args != null && args.Length > 1) {
				var extraDirs = args.Skip (1);
				extraDocs = extraDirs
					.Where (d => d.StartsWith ("+"))
					.Select (d => d.Substring (1))
					.Where (d => Directory.Exists (d));
				extraUncompiledDocs = extraDirs
					.Where (d => d.StartsWith ("@"))
					.Select (d => d.Substring (1))
					.Where (d => Directory.Exists (d));
			}

			if (extraUncompiledDocs != null)
				foreach (var dir in extraUncompiledDocs)
					RootTree.UncompiledHelpSources.Add (dir);

			Root = RootTree.LoadTree (null);

			if (extraDocs != null)
				foreach (var dir in extraDocs)
					Root.AddSource (dir);
			
			var macDocPath = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData), "macdoc");
			if (!Directory.Exists (macDocPath))
				Directory.CreateDirectory (macDocPath);
			var helpSources = Root.HelpSources
				.Cast<HelpSource> ()
				.Where (hs => !string.IsNullOrEmpty (hs.BaseFilePath) && !string.IsNullOrEmpty (hs.Name))
				.Select (hs => Path.Combine (hs.BaseFilePath, hs.Name + ".zip"))
				.Where (File.Exists);
			IndexUpdateManager = new IndexUpdateManager (helpSources,
			                                             macDocPath);
			BookmarkManager = new BookmarkManager (macDocPath);
			AppleDocHandler = new AppleDocHandler ("/Library/Frameworks/Mono.framework/Versions/Current/etc/");
			
			// Configure the documentation rendering.
			SettingsHandler.Settings.EnableEditing = false;
			SettingsHandler.Settings.preferred_font_size = 200;
			HelpSource.use_css = true;
		}
Exemplo n.º 9
0
        public void TestInitialPositionBookMark(bool acknowledge)
        {
            var records  = new ListEventSink();
            var sourceId = "TestEvtInitialPositionBookMark";
            var eventId  = (int)(DateTime.Now.Ticks % ushort.MaxValue);
            var msg      = "A fresh message";

            // Write some events before the source is created
            for (int i = 0; i < 3; i++)
            {
                EventLog.WriteEntry(LogSource, msg, EventLogEntryType.Information, eventId);
            }

            var now = DateTime.UtcNow;

            using (var source = CreateSource(sourceId, eventId))
            {
                source.Subscribe(records);
                source.Id = sourceId;
                source.InitialPosition = InitialPositionEnum.Bookmark;
                source.Start();

                Thread.Sleep(2000);

                // When using Bookmark as Initial position, and there is no bookmark, it should not process old events.
                Assert.Empty(records);

                EventLog.WriteEntry(LogSource, msg, EventLogEntryType.Information, eventId);

                Thread.Sleep(1000);

                if (acknowledge)
                {
                    // Send the acknowledgements as if they had come from sources.
                    var bookmark = Assert.IsType <BookmarkInfo>(BookmarkManager.GetBookmark(sourceId));
                    BookmarkManager.SaveBookmark(bookmark.Id, records.Last().Position, null);
                }

                source.Stop();
                Thread.Sleep(1000);

                var lastRecordTimestamp = Assert.Single(records).Timestamp;
                Assert.True(lastRecordTimestamp > now);

                records.Clear();

                //Write some new logs after the source stop
                var newmsg = "A fresh message after source stop";
                EventLog.WriteEntry(LogSource, newmsg, EventLogEntryType.Information, eventId);
                Thread.Sleep(1000);
                source.Start();
                Thread.Sleep(1000);

                // If it's a clean shutdown (i.e. config reload), the bookmark isn't removed from BookmarkManager,
                // so the source should pick up where it left off according to the previous bookmark value.
                if (acknowledge)
                {
                    var lastRecord = Assert.Single(records);
                    Assert.True(lastRecord.Timestamp > lastRecordTimestamp);
                    Assert.Matches("after source stop", lastRecord.GetMessage("string"));
                }
                else
                {
                    // When using Bookmark as Initial position, and there is no bookmark, it should not process old events.
                    // Since we didn't commit the bookmark in this theory, no records should be returned.
                    Assert.Empty(records);
                }
            }
        }
Exemplo n.º 10
0
 public override void Run()
 {
     BookmarkManager.RemoveAll(b => b is BreakpointBookmark);
 }
Exemplo n.º 11
0
        internal override void InternalCancel(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
        {
            NativeActivityContext context = executor.NativeActivityContextPool.Acquire();

            try
            {
                context.Initialize(instance, executor, bookmarkManager);
                Cancel(context);
            }
            finally
            {
                context.Dispose();
                executor.NativeActivityContextPool.Release(context);
            }
        }
Exemplo n.º 12
0
        public SourceStorageItemsPageViewModel(
            IEventAggregator eventAggregator,
            FolderListingSettings folderListingSettings,
            BookmarkManager bookmarkManager,
            ThumbnailManager thumbnailManager,
            PathReferenceCountManager PathReferenceCountManager,
            SourceStorageItemsRepository sourceStorageItemsRepository,
            RecentlyAccessManager recentlyAccessManager,
            SecondaryTileManager secondaryTileManager,
            SourceChoiceCommand sourceChoiceCommand,
            OpenFolderItemCommand openFolderItemCommand,
            OpenImageViewerCommand openImageViewerCommand,
            OpenFolderListupCommand openFolderListupCommand,
            OpenWithExplorerCommand openWithExplorerCommand,
            SecondaryTileAddCommand secondaryTileAddCommand,
            SecondaryTileRemoveCommand secondaryTileRemoveCommand
            )
        {
            Folders                       = new ObservableCollection <StorageItemViewModel>();
            RecentlyItems                 = new ObservableCollection <StorageItemViewModel>();
            OpenFolderItemCommand         = openFolderItemCommand;
            SourceChoiceCommand           = sourceChoiceCommand;
            _sourceStorageItemsRepository = sourceStorageItemsRepository;
            _recentlyAccessManager        = recentlyAccessManager;
            SecondaryTileManager          = secondaryTileManager;
            _eventAggregator              = eventAggregator;
            OpenImageViewerCommand        = openImageViewerCommand;
            OpenFolderListupCommand       = openFolderListupCommand;
            OpenWithExplorerCommand       = openWithExplorerCommand;
            SecondaryTileAddCommand       = secondaryTileAddCommand;
            SecondaryTileRemoveCommand    = secondaryTileRemoveCommand;
            _bookmarkManager              = bookmarkManager;
            _thumbnailManager             = thumbnailManager;
            _PathReferenceCountManager    = PathReferenceCountManager;
            _folderListingSettings        = folderListingSettings;

            Groups = new[]
            {
                new SourceItemsGroup
                {
                    GroupId = "Folders",
                    Items   = Folders,
                },
                new SourceItemsGroup
                {
                    GroupId = "RecentlyUsedFiles",
                    Items   = RecentlyItems,
                },
            };

            _eventAggregator.GetEvent <SourceStorageItemsRepository.AddedEvent>()
            .Subscribe(args =>
            {
                var existInFolders = Folders.FirstOrDefault(x => x.Token == args.Token);
                if (existInFolders != null)
                {
                    Folders.Remove(existInFolders);
                }

                var existInFiles = RecentlyItems.FirstOrDefault(x => x.Token == args.Token);
                if (existInFiles != null)
                {
                    RecentlyItems.Remove(existInFiles);
                }

                var storageItemImageSource = new StorageItemImageSource(args.StorageItem, _thumbnailManager);
                if (storageItemImageSource.ItemTypes == Models.Domain.StorageItemTypes.Folder)
                {
                    // 追加用ボタンの次に配置するための 1
                    Folders.Insert(1, new StorageItemViewModel(storageItemImageSource, args.Token, _sourceStorageItemsRepository, _folderListingSettings, _bookmarkManager));
                }
                else if (storageItemImageSource.ItemTypes == Models.Domain.StorageItemTypes.Image ||
                         storageItemImageSource.ItemTypes == Models.Domain.StorageItemTypes.Archive ||
                         storageItemImageSource.ItemTypes == Models.Domain.StorageItemTypes.EBook
                         )
                {
                    RecentlyItems.Insert(0, new StorageItemViewModel(storageItemImageSource, args.Token, _sourceStorageItemsRepository, _folderListingSettings, _bookmarkManager));
                }
            })
            .AddTo(_disposables);

            _eventAggregator.GetEvent <SourceStorageItemsRepository.RemovedEvent>()
            .Subscribe(args =>
            {
                var existInFolders = Folders.FirstOrDefault(x => x.Token == args.Token);
                if (existInFolders != null)
                {
                    Folders.Remove(existInFolders);
                }

                var existInFiles = RecentlyItems.Where(x => x.Token == args.Token).ToList();
                foreach (var item in existInFiles)
                {
                    RecentlyItems.Remove(item);
                }
            })
            .AddTo(_disposables);
        }
Exemplo n.º 13
0
 public Startup(IConfiguration configuration, IWebHostEnvironment webHostEnv)
 {
     Configuration = configuration;
     EnvRootPath   = webHostEnv.ContentRootPath;
     BookmarkManager bookmarkManager = new BookmarkManager(EnvRootPath);
 }
Exemplo n.º 14
0
        internal sealed override void InternalExecute(System.Activities.ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
        {
            AsyncOperationContext asyncContext = executor.SetupAsyncOperationBlock(instance);

            instance.IncrementBusyCount();
            AsyncCodeActivityContext context = new AsyncCodeActivityContext(asyncContext, instance, executor);
            bool flag = false;

            try
            {
                IAsyncResult result = this.BeginExecute(context, AsyncCodeActivity.OnExecuteComplete, asyncContext);
                if (result == null)
                {
                    throw FxTrace.Exception.AsError(new InvalidOperationException(System.Activities.SR.BeginExecuteMustNotReturnANullAsyncResult));
                }
                if (!object.ReferenceEquals(result.AsyncState, asyncContext))
                {
                    throw FxTrace.Exception.AsError(new InvalidOperationException(System.Activities.SR.BeginExecuteMustUseProvidedStateAsAsyncResultState));
                }
                if (result.CompletedSynchronously)
                {
                    ((IAsyncCodeActivity)this).FinishExecution(context, result);
                    asyncContext.CompleteOperation();
                }
                flag = true;
            }
            finally
            {
                context.Dispose();
                if (!flag)
                {
                    asyncContext.CancelOperation();
                }
            }
        }
 internal NativeActivityTransactionContext(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarks, RuntimeTransactionHandle handle)
     : base(instance, executor, bookmarks)
 {
     this.executor          = executor;
     this.transactionHandle = handle;
 }
Exemplo n.º 16
0
        internal sealed override void InternalCancel(System.Activities.ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
        {
            AsyncOperationContext context;

            if (executor.TryGetPendingOperation(instance, out context))
            {
                using (AsyncCodeActivityContext context2 = new AsyncCodeActivityContext(context, instance, executor))
                {
                    context.HasCalledAsyncCodeActivityCancel = true;
                    this.Cancel(context2);
                }
            }
        }
 void PinCloseControl_Closed(object sender, EventArgs e)
 {
     BookmarkManager.RemoveMark(Mark);
     Close();
 }
Exemplo n.º 18
0
        public void TestInitialPositionBOS(bool acknowledge)
        {
            var records  = new ListEventSink();
            var sourceId = "TestEvtInitialPositionTimeStamp";
            var eventId  = (int)(DateTime.Now.Ticks % ushort.MaxValue);
            var msg      = "A fresh message";

            // Write some events before the source is created
            for (int i = 0; i < 3; i++)
            {
                EventLog.WriteEntry(LogSource, msg, EventLogEntryType.Information, eventId);
            }

            var now = DateTime.UtcNow;

            using (var source = CreateSource(sourceId, eventId))
            {
                source.Subscribe(records);
                source.Id = sourceId;
                source.InitialPosition = InitialPositionEnum.BOS;
                source.Start();

                for (int i = 0; i < 5; i++)
                {
                    EventLog.WriteEntry(LogSource, msg, EventLogEntryType.Information, eventId);
                }

                Thread.Sleep(5000);

                if (acknowledge)
                {
                    // Send the acknowledgements as if they had come from sources.
                    var bookmark = Assert.IsType <BookmarkInfo>(BookmarkManager.GetBookmark(sourceId));
                    BookmarkManager.SaveBookmark(bookmark.Id, records.Last().Position, null);
                }

                source.Stop();
                Thread.Sleep(1000);

                Assert.True(records[0].Timestamp < now, $"First record should have been written before {now}, but was written at {records[0].Timestamp}");

                var lastRecordTimestamp = records.Last().Timestamp;
                Assert.True(lastRecordTimestamp > now, $"Last record should have been written after {now}, but was written at {records.Last().Timestamp}");

                records.Clear();

                //Write some new logs after the source stop
                var newmsg = "A fresh message after source stop";
                EventLog.WriteEntry(LogSource, newmsg, EventLogEntryType.Information, eventId);
                Thread.Sleep(1000);
                source.Start();
                Thread.Sleep(3000);

                IEnvelope lastRecord;
                if (acknowledge)
                {
                    lastRecord = Assert.Single(records);
                }
                else
                {
                    Assert.Equal(9, records.Count);
                    lastRecord = records.Last();
                }

                Assert.True(lastRecord.Timestamp > lastRecordTimestamp);
                Assert.Matches("after source stop", lastRecord.GetMessage("string"));
            }
        }
        sealed internal override void InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
        {
            // first set up an async context
            AsyncOperationContext asyncContext = executor.SetupAsyncOperationBlock(instance);

            instance.IncrementBusyCount();

            AsyncCodeActivityContext context = new AsyncCodeActivityContext(asyncContext, instance, executor);
            bool success = false;

            try
            {
                IAsyncResult result = BeginExecute(context, AsyncCodeActivity.OnExecuteComplete, asyncContext);

                if (result == null)
                {
                    throw FxTrace.Exception.AsError(new InvalidOperationException(SR.BeginExecuteMustNotReturnANullAsyncResult));
                }

                if (!object.ReferenceEquals(result.AsyncState, asyncContext))
                {
                    throw FxTrace.Exception.AsError(new InvalidOperationException(SR.BeginExecuteMustUseProvidedStateAsAsyncResultState));
                }

                if (result.CompletedSynchronously)
                {
                    EndExecute(context, result);
                    asyncContext.CompleteOperation();
                }
                success = true;
            }
            finally
            {
                context.Dispose();
                if (!success)
                {
                    asyncContext.CancelOperation();
                }
            }
        }
Exemplo n.º 20
0
 public FormAddBookmarkWithNewFolder(ImageReferenceElement imageReference, BookmarkService bookmarkService, BookmarkManager bookmarkManager)
 {
     _imageReference    = imageReference;
     _bookmarkService   = bookmarkService;
     _bookmarkManager   = bookmarkManager;
     rootBookmarkFolder = _bookmarkManager.RootFolder;
     InitializeComponent();
 }
Exemplo n.º 21
0
 internal override void InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
 {
     if (this.runtimeImplementation != null)
     {
         executor.ScheduleActivity(this.runtimeImplementation, instance, null, null, null);
     }
 }
 internal sealed override void InternalCancel(System.Activities.ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
 {
 }
Exemplo n.º 23
0
 /// <summary>
 /// Handles the Click event of the ManageBookmarks control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>
 private void ManageBookmarks_Click(object sender, RoutedEventArgs e)
 {
     BookmarkManager bookmarkManager = new BookmarkManager(this);
     bookmarkManager.ShowDialog();
     SetBookmarkMenus();
 }
Exemplo n.º 24
0
        protected override void OnMouseUp(MouseButtonEventArgs e)
        {
            base.OnMouseUp(e);
            int line = GetLineFromMousePosition(e);

            if (!e.Handled && dragDropBookmark != null)
            {
                if (dragStarted)
                {
                    if (line != 0)
                    {
                        dragDropBookmark.Drop(line);
                    }
                    e.Handled = true;
                }
                CancelDragDrop();
            }
            if (!e.Handled && line != 0)
            {
                BookmarkBase bm = GetBookmarkFromLine(line);
                if (bm != null)
                {
                    bm.MouseUp(e);

                    if (bm.CanToggle)
                    {
                        BookmarkManager.RemoveMark(bm);
                        InvalidateVisual();
                    }

                    if (e.Handled)
                    {
                        return;
                    }
                }
                if (e.ChangedButton == MouseButton.Left)
                {
                    if (DebugData.CodeMappings != null && DebugData.CodeMappings.Count > 0)
                    {
                        // check if the codemappings exists for this line
                        var storage = DebugData.CodeMappings;
                        int token   = 0;
                        foreach (var key in storage.Keys)
                        {
                            var instruction = storage[key].GetInstructionByLineNumber(line, out token);

                            if (instruction == null)
                            {
                                continue;
                            }

                            // no bookmark on the line: create a new breakpoint
                            DebuggerService.ToggleBreakpointAt(
                                DebugData.DecompiledMemberReferences[key],
                                line,
                                instruction.ILInstructionOffset,
                                DebugData.Language);
                            break;
                        }

                        if (token == 0)
                        {
                            MessageBox.Show(string.Format("Missing code mappings at line {0}.", line),
                                            "Code mappings", MessageBoxButton.OK, MessageBoxImage.Information);
                            return;
                        }
                    }
                }
                InvalidateVisual();
            }
        }
        internal void PDFRendererControl_KeyUp(object sender, KeyEventArgs e)
        {
            if ((Keyboard.Modifiers & ModifierKeys.Control) != 0)
            {
                switch (e.Key)
                {
                case Key.P:
                    if (ZoomType.Zoom1Up == zoom_type)
                    {
                        PageZoom(ZoomType.Zoom2Up);
                    }
                    else
                    {
                        PageZoom(ZoomType.Zoom1Up);
                    }

                    e.Handled = true;
                    break;

                case Key.M:
                    ReconsiderOperationMode(OperationMode.Hand);
                    e.Handled = true;

                    break;

                case Key.A:
                    ReconsiderOperationMode(OperationMode.Annotation);
                    e.Handled = true;
                    break;

                case Key.H:
                    ReconsiderOperationMode(OperationMode.Highlighter);
                    e.Handled = true;
                    break;

                case Key.S:
                    ReconsiderOperationMode(OperationMode.TextSentenceSelect);
                    e.Handled = true;
                    break;

                case Key.I:
                    ReconsiderOperationMode(OperationMode.Ink);
                    e.Handled = true;
                    break;

                case Key.R:
                    ReconsiderOperationMode(OperationMode.Camera);
                    e.Handled = true;
                    break;

                case Key.B:
                    GoogleBibTexSnifferControl sniffer = new GoogleBibTexSnifferControl();
                    sniffer.Show(pdf_renderer_control_stats.pdf_document);
                    e.Handled = true;
                    break;

                case Key.Add:
                case Key.OemPlus:
                    IncrementalZoom(+1);
                    e.Handled = true;
                    break;

                case Key.Subtract:
                case Key.OemMinus:
                    IncrementalZoom(-1);
                    e.Handled = true;
                    break;

                default:
                    if (Key.D1 <= e.Key && Key.D9 >= e.Key)
                    {
                        if (KeyboardTools.IsShiftDown())
                        {
                            int bookmark_number = BookmarkManager.KeyToBookmarkNumber(e.Key);
                            BookmarkManager.SetDocumentBookmark(pdf_renderer_control_stats.pdf_document, bookmark_number, ScrollPages.VerticalOffset / ScrollPages.ScrollableHeight);
                            StatusManager.Instance.UpdateStatus("Bookmarks", "Set bookmark " + bookmark_number);

                            e.Handled = true;
                        }

                        else
                        {
                            int    bookmark_number = BookmarkManager.KeyToBookmarkNumber(e.Key);
                            double vertical_offset = BookmarkManager.GetDocumentBookmark(pdf_renderer_control_stats.pdf_document, bookmark_number);
                            ScrollPages.ScrollToVerticalOffset(vertical_offset * ScrollPages.ScrollableHeight);
                            StatusManager.Instance.UpdateStatus("Bookmarks", "Jumped to bookmark " + bookmark_number);

                            e.Handled = true;
                        }
                    }
                    break;
                }
            }
        }
Exemplo n.º 26
0
 sealed internal override void InternalCancel(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
 {
     Fx.Assert("Cancel should never be called on CodeActivity since it's synchronous");
 }
Exemplo n.º 27
0
 internal void Cancel(ActivityExecutor executor, BookmarkManager bookmarkManager)
 {
     this.Activity.InternalCancel(this, executor, bookmarkManager);
 }
Exemplo n.º 28
0
 public LinkController(IUnitOfWork db, IMapper mapper)
 {
     _db             = db;
     _mapper         = mapper;
     BookmarkManager = new BookmarkManager();
 }
Exemplo n.º 29
0
        sealed internal override void InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
        {
            CodeActivityContext context = executor.CodeActivityContextPool.Acquire();

            try
            {
                context.Initialize(instance, executor);
                Execute(context);
            }
            finally
            {
                context.Dispose();
                executor.CodeActivityContextPool.Release(context);
            }
        }
Exemplo n.º 30
0
        public void RebuildMenu()
        {
            _MenuItems.ForEach(item => item.Refresh());

            BookmarkManager bookmarkManager = BookmarkManager.Instance;

            List <NativeMenuItem> sortedList = _MenuItems.ToList();

            sortedList.Sort((a, b) => {
                VagrantInstance firstInstance  = a.Instance;
                VagrantInstance secondInstance = b.Instance;

                bool firstBookmarked  = bookmarkManager.GetBookmarkWithPath(firstInstance.Path) != null;
                bool secondBookmarked = bookmarkManager.GetBookmarkWithPath(secondInstance.Path) != null;

                int firstRunningCount  = firstInstance.GetRunningMachineCount();
                int secondRunningCount = secondInstance.GetRunningMachineCount();

                if (firstBookmarked && !secondBookmarked)
                {
                    return(-1);
                }
                else if (secondBookmarked && !firstBookmarked)
                {
                    return(1);
                }
                else
                {
                    if (firstRunningCount > 0 && secondRunningCount == 0)
                    {
                        return(-1);
                    }
                    else if (secondRunningCount > 0 && firstRunningCount == 0)
                    {
                        return(1);
                    }
                    else
                    {
                        int firstIdx  = bookmarkManager.GetIndexOfBookmarkWithPath(firstInstance.Path);
                        int secondIdx = bookmarkManager.GetIndexOfBookmarkWithPath(secondInstance.Path);

                        if (firstIdx < secondIdx)
                        {
                            return(-1);
                        }
                        else if (secondIdx < firstIdx)
                        {
                            return(1);
                        }
                        else
                        {
                            return(firstInstance.DisplayName.CompareTo(secondInstance.DisplayName));
                        }
                    }
                }
            });

            sortedList.ForEach(item => {
                if (_Menu.Items.Contains(item.MenuItem))
                {
                    _Menu.Items.Remove(item.MenuItem);
                }

                _Menu.Items.Insert(_Menu.Items.IndexOf(_BottomMachineSeparator), item.MenuItem);
            });

            _MenuItems = sortedList;

            if (_Menu.Items.Contains(_TopMachineSeparator))
            {
                _Menu.Items.Remove(_TopMachineSeparator);
            }

            if (_MenuItems.Count > 0)
            {
                _Menu.Items.Insert(_Menu.Items.IndexOf(_RefreshMenuItem) + 1, _TopMachineSeparator);
            }
        }