public ShowTextDialog (string text, string mimeType) { this.Build(); SourceLanguagesManager lm = new SourceLanguagesManager (); SourceLanguage lang = null; if (String.IsNullOrEmpty (mimeType)) lang = lm.GetLanguageFromMimeType (mimeType); SourceBuffer buf = null; if (lang == null) { SourceTagTable table = new SourceTagTable (); buf = new SourceBuffer (table); } else { buf = new SourceBuffer (lang); buf.Highlight = true; } sourceView = new SourceView (buf); sourceView.ShowLineNumbers = true; sourceView.Editable = false; vboxContent.PackStart (sourceView, true, true, 0); vboxContent.ShowAll (); if (text != null) sourceView.Buffer.Text = text; }
private async void LoadPenjualan(ModelsShared.Models.Customer value) { if (value != null) { ProgressIsActive = true; this.Invoicedetail.Clear(); SourceView.Refresh(); var x = await MainVM.PenjualanCollection.GetPenjualanNotPaid(value.Id); if (x != null && x.Count > 0) { var r = (from item in x join c in MainVM.CityCollection.Source on item.Reciver.CityID equals c.Id select new ModelsShared.Models.Invoicedetail { PenjualanId = item.Id, Penjualan = item }).ToList(); foreach (var item in r) { item.PropertyChanged += (m, y) => { Item_TotalAction(); Save.CanExecute(null); }; Invoicedetail.Add(item); } } SourceView.Refresh(); ProgressIsActive = false; } }
private async void LoadData(DateTime startDate, DateTime endDate) { try { if (IsBusy) { return; } IsBusy = true; var result = await ptiContext.GetPTIFromTo(StartDate, EndDate); await Task.Delay(500); Source.Clear(); foreach (var item in result) { Source.Add(item); } SourceView.Refresh(); } catch (Exception ex) { Helpers.ShowMessage(ex.Message); }finally { IsBusy = false; } }
private async void RefreshAction(object obj) { await Task.Delay(300); try { if (IsBusy) { return; } IsBusy = true; SourceView.Clear(); var results = await LayananServices.GetItemsAsync(); var group = results.GroupBy(O => O.Kategori.Nama); kategori.Clear(); kategori.Add("All"); foreach (var d in group) { kategori.Add(d.Key); } foreach (var item in results) { SourceView.Add(item); } } finally { IsBusy = false; } }
internal async void Filter(string result) { try { if (IsBusy) { return; } IsBusy = true; await Task.Delay(300); SourceView.Clear(); if (result != "Cancel" && result != "All") { var results = await LayananServices.GetItemsAsync(); foreach (var item in results.Where(O => O.Kategori.Nama == result)) { SourceView.Add(item); } } else if (result == "All") { RefreshCommand.Execute(null); } } finally { IsBusy = false; } }
private void SetDetailsToNewCollie(List <ModelsShared.Models.Colly> details) { var config = new ApplicationConfig(); Source.Clear(); foreach (var item in details) { var data = new Newcolly() { TypeOfWeight = item.TypeOfWeight, CollyNumber = item.CollyNumber, Id = item.Id, IsSended = item.IsSended, PenjualanId = item.Id, Weight = item.Weight, Wide = item.Wide, Hight = item.Hight, Longer = item.Longer, WeightVolume = config.DevideWeightVolume, Jumlah = 1, }; Source.Add(data); item.PropertyChanged += (x, y) => { CalculateTotal(); }; } SourceView.Refresh(); }
public MainWindow() : base(Gtk.WindowType.Toplevel) { Build(); Preferences.AddNotify(new GConf.NotifyEventHandler(OnGConfChanged)); manager = new SourceLanguageManager(); language = manager.GetLanguage("c-sharp"); buffer = new SourceBuffer(language); textView = new SourceView(buffer); textView.TabWidth = 4; OnGConfChanged(null, null); buffer.Changed += new EventHandler(OnBufferChanged); buffer.MarkSet += new MarkSetHandler(OnBufferMarkSet); scrolledwindow.Add(textView); scrolledwindow.ShowAll(); Focus = textView; originalBuffer = ""; NewFile(); }
internal async Task <bool> Update(int id, Penjualan penj) { var item = await client.PutAsync <Penjualan>("", id, penj); var data = Source.Where(O => O.Id == id).FirstOrDefault(); if (item != default(Penjualan) && data != null) { data.CustomerIsPay = item.CustomerIsPay; data.Colly = item.Colly; data.Etc = item.Etc; data.FromCity = item.FromCity; data.ToCity = item.ToCity; data.PackingCosts = item.PackingCosts; data.PayType = item.PayType; data.PortType = item.PortType; data.Price = item.Price; data.ReciverID = item.ReciverID; data.ShiperID = item.ShiperID; data.STT = item.STT; data.Tax = item.Tax; data.Total = item.Total; data.TypeOfWeight = item.TypeOfWeight; data.UserID = item.UserID; data.Content = item.Content; data.DoNumber = item.DoNumber; data.Id = item.Id; data.ChangeDate = item.ChangeDate; data.Note = item.Note; SourceView.Refresh(); return(true); } return(false); }
/// <summary> /// Constructor. /// </summary> /// <param name="ShowError">A function which will display an error to the user.</param> /// <param name="view">The SourceView widget. Used in creation of method signature popup.</param> public ScriptCompletionProvider(Action <Exception> ShowError, SourceView view) : base() { this.ShowError = ShowError; this.view = view; view.Completion.ShowHeaders = false; view.KeyPressEvent += OnCompletionInfoKeyPress; }
protected void OnItemtreeRowActivated(object o, RowActivatedArgs args) { var rec = treeManager.GetItem(args.Path, 0); if (rec != null) { if (rec.SourceFile != null) { var toopen = from r in records where r.SourceFile == rec.SourceFile select r; var tmp = new List <CodeRecord> (toopen); OpenSourceFile(tmp); SourceView sv = null; string localfile = null; if (fsmap.SourceMap.TryGetValue(rec.SourceFile, out localfile)) { // assuming it is open, scroll to the thing we clicked if (sourceviews.TryGetValue(localfile, out sv)) { var tm = new TextMark(rec.FullMethodName, true); var iter = sv.Buffer.GetIterAtLine(rec.GetLines()[0] - 1); sv.Buffer.AddMark(tm, iter); sv.ScrollToMark(tm, 0.3, true, 0.2, 0.2); sv.ScrollMarkOnscreen(tm); sv.Buffer.PlaceCursor(iter); } } } } }
private static void Setup(Window wnd, string languageID) { VBox box = new VBox(); ScrolledWindow scrolled = new ScrolledWindow(); SourceView view = new SourceView(); view.ShowLineNumber = true; view.HighlightSyntax = true; view.HighlightCurrentLine = true; view.AutoIndent = true; scrolled.Add(view); LanguageManager languageManager = new LanguageManager(); var s = languageManager.GetSearchPath(); s.Add(Environment.CurrentDirectory + "/language-specs"); languageManager.SetSearchPath(s.ToArray()); view.Language = languageManager.GetGuessLanguage(languageID, null); StyleSchemeManager styleSchemeManager = new StyleSchemeManager(); var ss = styleSchemeManager.GetSearchPath(); ss.Add(Environment.CurrentDirectory + "/styles"); styleSchemeManager.SetSearchPath(ss.ToArray()); view.StyleScheme = styleSchemeManager.GetScheme("oblivion"); box.PackEnd(scrolled, true, true, 0); wnd.Add(box); }
public void TestSerializeSourceView() { MSSQLProvider p = new MSSQLProvider(GetTestDB(), null); SourceView view = p.GetSourceView(); //XmlSerializer s = new XmlSerializer(typeof(SourceView)); //s.Serialize(Console.Out, view); BinaryFormatter f = new BinaryFormatter(); using (MemoryStream ms = new MemoryStream()) { f.Serialize(ms, view); ms.Position = 0; view = (SourceView)f.Deserialize(ms); } Assert.AreEqual(133, view.SourceFields.Count()); Assert.AreEqual(32, view.GetSourceFragments().Count()); foreach (SourceFragmentDefinition fragment in view.GetSourceFragments()) { Assert.IsTrue(view.GetSourceFields(fragment).Count() > 0); } }
public void TestFillModel() { MSSQLProvider p = new MSSQLProvider(GetTestDB(), null); SourceView sv = p.GetSourceView(null, "ent1,ent2,1to2"); WXMLModel model = new WXMLModel(); SourceToModelConnector c = new SourceToModelConnector(sv, model); c.ApplySourceViewToModel(); Assert.AreEqual(3, model.GetSourceFragments().Count()); Assert.AreEqual(2, model.GetEntities().Count()); Assert.IsNotNull(model.GetEntity("e_dbo_ent1")); Assert.IsNotNull(model.GetEntity("e_dbo_ent2")); Assert.AreEqual(1, model.GetEntity("e_dbo_ent1").GetProperties().Count()); Assert.AreEqual(1, model.GetEntity("e_dbo_ent1").GetPkProperties().Count()); Assert.IsTrue(model.GetEntity("e_dbo_ent1").GetPkProperties().First().HasAttribute(Field2DbRelations.PrimaryKey)); Assert.AreEqual(2, model.GetEntity("e_dbo_ent2").GetProperties().Count()); Assert.AreEqual(1, model.GetRelations().Count()); }
public void TestDropProperty() { MSSQLProvider p = new MSSQLProvider(GetTestDB(), null); SourceView sv = p.GetSourceView(null, "aspnet_Applications"); Assert.AreEqual(4, sv.SourceFields.Count); WXMLModel model = new WXMLModel(); SourceToModelConnector c = new SourceToModelConnector(sv, model); c.ApplySourceViewToModel(); Assert.AreEqual(4, model.GetActiveEntities().First().GetActiveProperties().Count()); SourceFieldDefinition fld = sv.SourceFields.Find(item => item.SourceFieldExpression == "[Description]"); sv.SourceFields.Remove(fld); Assert.AreEqual(3, sv.SourceFields.Count); c.ApplySourceViewToModel(true, relation1to1.Default, true, true, false); Assert.AreEqual(3, model.GetActiveEntities().First().GetActiveProperties().Count()); sv.SourceFields.Add(fld); Assert.AreEqual(4, sv.SourceFields.Count); c.ApplySourceViewToModel(true, relation1to1.Default, true, true, false); Assert.AreEqual(4, model.GetActiveEntities().First().GetActiveProperties().Count()); }
public void TestAlterEntities() { MSSQLProvider p = new MSSQLProvider(GetTestDB(), null); SourceView sv = p.GetSourceView(null, "ent1,ent2,1to2"); WXMLModel model = new WXMLModel(); SourceToModelConnector c = new SourceToModelConnector(sv, model); c.ApplySourceViewToModel(); Assert.AreEqual(3, model.GetSourceFragments().Count()); Assert.AreEqual(2, model.GetEntities().Count()); sv = p.GetSourceView(null, "ent1,ent2,1to2"); c = new SourceToModelConnector(sv, model); c.ApplySourceViewToModel(); Assert.AreEqual(3, model.GetSourceFragments().Count()); Assert.AreEqual(2, model.GetEntities().Count()); }
public void TestFillModelRelations() { MSSQLProvider p = new MSSQLProvider(GetTestDB(), null); SourceView sv = p.GetSourceView(null, "aspnet_Applications,aspnet_Paths"); WXMLModel model = new WXMLModel(); SourceToModelConnector c = new SourceToModelConnector(sv, model); c.ApplySourceViewToModel(); Assert.AreEqual(2, model.GetSourceFragments().Count()); Assert.AreEqual(2, model.GetEntities().Count()); var aspnet_Applications = model.GetEntity("e_dbo_aspnet_Applications"); Assert.IsNotNull(aspnet_Applications); var aspnet_Paths = model.GetEntity("e_dbo_aspnet_Paths"); Assert.IsNotNull(aspnet_Paths); Assert.IsNotNull(aspnet_Paths.GetProperty("Application")); Assert.IsNotNull(aspnet_Paths.GetProperty("PathId")); Assert.IsNotNull(aspnet_Paths.GetProperty("Path")); Assert.IsNotNull(aspnet_Paths.GetProperty("LoweredPath")); Assert.AreEqual(1, aspnet_Applications.One2ManyRelations.Count()); Assert.AreEqual(aspnet_Paths, aspnet_Applications.One2ManyRelations.First().Entity); }
private SourceFragmentDefinition GetMasterTable(SourceFragmentDefinition sf, out List <SourceFragmentRefDefinition.Condition> conditions) { SourceConstraint fk = SourceView.GetSourceFields(sf) .Where(item => item.IsPK) .SelectMany(item => item.Constraints) .Single(item => item.ConstraintType == SourceConstraint.ForeignKeyConstraintTypeName); SourceFragmentDefinition m = null; conditions = new List <SourceFragmentRefDefinition.Condition>(); foreach (SourceReferences rel in SourceView.GetFKRelations(fk)) { if (m == null) { m = rel.PKField.SourceFragment; } conditions.Add(new SourceFragmentRefDefinition.Condition( rel.PKField.SourceFieldExpression, rel.FKField.SourceFieldExpression )); } return(m); }
private void OnTreeViewItemMouseRightButtonDown(object sender, MouseButtonEventArgs e) { if (e.Source is FrameworkElement) { e.Handled = true; FrameworkElement item = e.Source as FrameworkElement; Application.Current.Dispatcher.Invoke(new Action(() => { Object windowDataContext = null; if (item.DataContext is SamplingNode) { windowDataContext = SourceView <SamplingBoardItem, SamplingDescription, SamplingNode> .Create(SummaryTable.DataContext as Board <SamplingBoardItem, SamplingDescription, SamplingNode>, (item.DataContext as SamplingNode).Description.Path); } else if (item.DataContext is EventNode) { windowDataContext = SourceView <EventBoardItem, EventDescription, EventNode> .Create(SummaryTable.DataContext as Board <EventBoardItem, EventDescription, EventNode>, (item.DataContext as EventNode).Description.Path); } if (windowDataContext != null) { new SourceWindow() { DataContext = windowDataContext, Owner = Application.Current.MainWindow }.Show(); } })); } }
private void Row_DoubleClick(object sender, RoutedEventArgs e) { if (!(sender is DataGridRow)) { return; } Object rowDataContext = (sender as DataGridRow).DataContext; Object windowDataContext = null; if (rowDataContext is SamplingBoardItem) { windowDataContext = SourceView <SamplingBoardItem, SamplingDescription, SamplingNode> .Create(DataContext as Board <SamplingBoardItem, SamplingDescription, SamplingNode>, (rowDataContext as SamplingBoardItem).Description.Path); } else if (rowDataContext is EventBoardItem) { windowDataContext = SourceView <EventBoardItem, EventDescription, EventNode> .Create(DataContext as Board <EventBoardItem, EventDescription, EventNode>, (rowDataContext as EventBoardItem).Description.Path); } if (windowDataContext != null) { new SourceWindow() { DataContext = windowDataContext }.Show(); } }
public async void SetManifest(manifestoutgoing manifest) { Source.Clear(); this._manifest = manifest; var stt = _manifest.PackingList.GroupBy(O => O.PenjualanId).ToList(); foreach (var item in stt) { var result = await MainVM.PenjualanCollection.GetItemById(item.Key); if (result != null) { var detail = from b in item.ToList() join c in result.Details on b.CollyNumber equals c.CollyNumber select c; var newItem = new Models.ManifestView(); newItem.STT = string.Format("{0:D5}", result.STT); newItem.Code = _manifest.Code; newItem.PortType = manifest.PortType.ToString(); newItem.PayType = result.PayType; newItem.Pcs = item.Count(); newItem.WeightView = detail.Sum(O => O.Weight); newItem.ShiperName = MainVM.CustomerCollection.Source.Where(O => O.Id == result.ShiperID).FirstOrDefault().Name; newItem.ReciverName = MainVM.CustomerCollection.Source.Where(O => O.Id == result.ReciverID).FirstOrDefault().Name; newItem.AgentName = _manifest.Agent.Name; newItem.CreatedDate = _manifest.CreatedDate; Source.Add(newItem); } } SourceView.Refresh(); }
private async void LoadData(DateTime startDate, DateTime endDate) { try { if (IsBusy) { return; } IsBusy = true; context = new DataAccessLayer.Bussines.SMUBussines(); List <SMU> datas = await context.GetSMU(startDate, endDate); Source.Clear(); foreach (var item in datas) { Source.Add(item); } SourceView.Refresh(); } catch (Exception ex) { Helpers.ShowErrorMessage(ex.Message); } finally { IsBusy = false; } }
public SMUViewModel() : base(typeof(SMUViewModel)) { MyTitle = "SURAT MUATAN UDARA"; var date = DateTime.Now; startDate = new DateTime(date.Year, date.Month, 1); endDate = startDate.AddMonths(1).AddDays(-1); RefreshCommand = new CommandHandler { CanExecuteAction = x => true, ExecuteAction = RefreshAction }; PrintSMUCommand = new CommandHandler { CanExecuteAction = x => true, ExecuteAction = PrintCommandAction }; OutManifestCommand = new CommandHandler { CanExecuteAction = x => true, ExecuteAction = OutManifestAction }; PrintPreviewSMUCommand = new CommandHandler { CanExecuteAction = x => true, ExecuteAction = PrintPreviewActionAsync }; CancelCommand = new CommandHandler { CanExecuteAction = x => true, ExecuteAction = x => WindowClose() }; CancelSMU = new CommandHandler { CanExecuteAction = CancelSMUValidate, ExecuteAction = CancelSMUAction }; Source = new ObservableCollection <SMU>(); SourceView = (CollectionView)CollectionViewSource.GetDefaultView(Source); SourceView.Filter = DataFilter; SourceView.Refresh(); LoadData(StartDate, EndDate); this.Aktif = true; this.Batal = false; }
/// <summary> /// /// </summary> /// <param name="action"></param> private void SelectView(string action) { PropertyView newView = null; switch (action) { case "Source Properties": newView = new SourceView(this._component); break; case "Code Expression Repository": newView = new ExpressionRepositoryView(this._component, true); break; case "Equation Repository": newView = new EquationRepositoryView(this._component, true); break; case "Destination Properties": newView = new DestinationView3D(this._component); break; } this.rightpanel.Controls.Add(newView); newView.Dock = DockStyle.Fill; if (_currentView != null) { _currentView.SaveData(); _currentView.Dispose(); _currentView = null; } _currentView = newView; _currentView.OnViewStatusChange += new ViewStatusChangeHandler(_currentView_OnViewStatusChange); }
private async void RefreshAction(object obj) { try { if (IsBusy) { return; } IsBusy = true; SourceView.Clear(); var results = await LayananServices.GetItemsAsync(); var group = results.GroupBy(O => O.Kategori.Nama); Kategories.Clear(); foreach (var d in group) { Kategories.Add(d.Key); } } catch (Exception ex) { Helper.ShowMessageError(ex.Message); } finally { IsBusy = false; } }
private void CancelManifestAction(object obj) { try { if (IsBusy) { return; } IsBusy = true; if (obj == null || string.IsNullOrEmpty(obj.ToString())) { throw new SystemException("Tambahkan Alasan Pembatalan"); } context.SetCancelManifest(ManifestSelected, obj.ToString()); obj = string.Empty; SourceView.Refresh(); } catch (Exception ex) { Helpers.ShowErrorMessage(ex.Message); } finally { IsBusy = false; } }
public async void LoadData(DateTime start, DateTime end) { try { if (IsBusy) { return; } IsBusy = true; var result = await context.GetManifest(start, end); Source.Clear(); foreach (var item in result) { Source.Add(item); } SourceView.Refresh(); } catch (Exception ex) { Helpers.ShowErrorMessage(ex.Message); } finally { IsBusy = false; } }
public MainForm() { InitializeComponent(); outputView = new OutputView(this); registersView = new RegisterView(this); displayView = new DisplayView(this); controlView = new ControlView(this); callStackView = new CallStackView(this); stackFrameView = new StackFrameView(this); statusView = new StatusView(this); symbolView = new SymbolView(this); watchView = new WatchView(this); breakPointView = new BreakpointView(this); instructionView = new InstructionView(this); methodView = new MethodView(this); //scriptView = new ScriptView(this); sourceView = new SourceView(this); sourceDataView = new SourceDataView(this); AppLocations.FindApplications(); Options.EnableQemuGDB = true; }
private async void EditScheduleAction(object obj) { try { ScheduleBussines scheduleContext = new ScheduleBussines(); var schedules = await scheduleContext.GetScheduleById(ManifestSelected.SchedulesId); if (schedules != null) { var form = new Views.AddNewSchecule(schedules); form.ShowDialog(); var vm = (AddNewScheduleViewModel)form.DataContext; if (vm.Success && vm.SchedulteCreated != null) { ManifestSelected.PlaneName = vm.SchedulteCreated.PlaneName; ManifestSelected.Tanggal = vm.SchedulteCreated.Tanggal; } SourceView.Refresh(); } } catch (Exception ex) { Helpers.ShowErrorMessage(ex.Message); } }
public void TestGenerateComplex() { SourceView sv = TestsSourceModel.TestsSourceModel.CreateComplexSourceView(); var model = new WXMLModel(); var smc = new SourceToModelConnector(sv, model); smc.ApplySourceViewToModel(); Assert.AreEqual(2, model.GetActiveEntities().Count()); Assert.AreEqual(4, model.GetActiveRelations().Count()); model.GetActiveRelations().First().Constraint = RelationConstraint.Unique; var msc = new ModelToSourceConnector(new SourceView(), model); var p = new MSSQLProvider(null, null); string script = msc.GenerateSourceScript(p, false); Assert.IsFalse(string.IsNullOrEmpty(script)); Console.WriteLine(script); Assert.AreEqual(6, new Regex("CREATE TABLE ").Matches(script).Count); Assert.AreEqual(2, new Regex("PRIMARY KEY CLUSTERED").Matches(script).Count); Assert.AreEqual(8, new Regex("FOREIGN KEY").Matches(script).Count); Assert.AreEqual(1, new Regex("UNIQUE CLUSTERED").Matches(script).Count); }
private void BuildViews() { VBox source_box = new VBox(); views_pane = new HPaned(); PersistentPaneController.Control(views_pane, SourceViewWidth); view_container = new ViewContainer(); source_view = new SourceView(); composite_view = new CompositeTrackSourceContents(); Hyena.Widgets.ScrolledWindow source_scroll = new Hyena.Widgets.ScrolledWindow(); source_scroll.AddWithFrame(source_view); composite_view.TrackView.HeaderVisible = false; view_container.Content = composite_view; source_box.PackStart(source_scroll, true, true, 0); source_box.PackStart(new UserJobTileHost(), false, false, 0); source_view.SetSizeRequest(125, -1); view_container.SetSizeRequest(425, -1); views_pane.Pack1(source_box, false, false); views_pane.Pack2(view_container, true, false); source_box.ShowAll(); view_container.Show(); views_pane.Show(); primary_vbox.PackStart(views_pane, true, true, 0); }
private void MenuShowSourceCode(object sender, RoutedEventArgs e) { if (e.Source is FrameworkElement) { FrameworkElement item = e.Source as FrameworkElement; Application.Current.Dispatcher.Invoke(new Action(() => { Object windowDataContext = null; if (item.DataContext is SamplingNode) { windowDataContext = SourceView <SamplingBoardItem, SamplingDescription, SamplingNode> .Create(SummaryTable.DataContext as Board <SamplingBoardItem, SamplingDescription, SamplingNode>, (item.DataContext as SamplingNode).Description.Path); } else { if (item.DataContext is EventNode) { windowDataContext = SourceView <EventBoardItem, EventDescription, EventNode> .Create(SummaryTable.DataContext as Board <EventBoardItem, EventDescription, EventNode>, (item.DataContext as EventNode).Description.Path); } } if (windowDataContext != null) { new SourceWindow() { DataContext = windowDataContext, Owner = Application.Current.MainWindow }.Show(); } })); } }
internal async void Filter(string result) { try { if (IsBusy) { return; } IsBusy = true; await Task.Delay(300); SourceView.Clear(); var results = await LayananServices.GetItemsAsync(); foreach (var item in results.Where(O => O.Kategori.Nama == result)) { SourceView.Add(item); } } finally { IsBusy = false; } }
public SqlEditorWidget() { this.Build(); SourceLanguagesManager lm = new SourceLanguagesManager (); SourceLanguage lang = lm.GetLanguageFromMimeType ("text/x-sql"); SourceBuffer buf = new SourceBuffer (lang); buf.Highlight = true; sourceView = new SourceView (buf); sourceView.ShowLineNumbers = true; sourceView.Buffer.Changed += new EventHandler (BufferChanged); sourceView.PopulatePopup += new PopulatePopupHandler (OnPopulatePopup); scrolledwindow.Add (sourceView); ShowAll (); }
public MainWindow() : base(Gtk.WindowType.Toplevel) { Build (); var lang = SourceLanguageManager.Default.GetLanguage ("xml"); sb = new SourceBuffer (lang); sb.HighlightSyntax = true; sb.HighlightMatchingBrackets = true; sv = new SourceView (sb); scrolledwindow1.Add (sv); updateTimer.Elapsed += delegate { RunUpdate (); }; sb.Changed += delegate { UpdatePreview (); }; vbox1.ShowAll (); }
public void Detach () { view.WidgetEventAfter -= OnWidgetEvent; view = null; }
public void OpenSourceFile (List<CodeRecord> recs) { if (recs.Count == 0) return; var filename = recs [0].SourceFile; var origfile = filename; var fbname = System.IO.Path.GetFileName(filename); if (openFiles.Contains (filename)) return; if ( fsmap.SourceMap.ContainsKey( filename ) ){ filename = fsmap.SourceMap[filename]; } while (!File.Exists(filename)) { var fc = new FileChooserDialog("Locate source file " + origfile, this, FileChooserAction.SelectFolder, "Cancel", ResponseType.Cancel, "Select", ResponseType.Apply); fc.Filter = new Gtk.FileFilter(){ Name = fbname }; fc.Filter.AddPattern( fbname ); fc.Response += (o, args) => { Console.Error.WriteLine( fc.Filename ); fc.Hide(); }; fc.Run(); if ( fc.Filename != null ){ filename = System.IO.Path.Combine( fc.Filename, fbname ); } else { return; } } fsmap.AddMapping( origfile, filename ); openFiles.Add (origfile); SourceLanguage language = sourceManager.GetLanguage ("c-sharp"); var buf = new SourceBuffer (language); TextTag visitedOnce = new TextTag ("visited_once") { Background = VisitedOnceBG }; TextTag visitedMore = new TextTag ("visited_more") { Background = VisitedMoreBG }; buf.TagTable.Add (visitedOnce); buf.TagTable.Add (visitedMore); buf.HighlightSyntax = true; buf.Text = System.IO.File.ReadAllText (filename); var page = new SourcePage (); var sv = new SourceView (buf); // sv.ScrollToIter (buf.GetIterAtLineOffset (22, 0), 1.1, false, 0.0, 0.0); sv.HighlightCurrentLine = true; sv.Editable = false; sv.ShowLineNumbers = true; var fp = System.IO.Path.GetFullPath (filename); page.Window.Add (sv); page.SetHeadingText (fp); page.SetSubHeadingText (""); var fname = System.IO.Path.GetFileName (filename); var tab = CloserTabLabel.InsertTabPage (notebook1, page, fname); tab.CloseKeyData = filename; page.ShowAll (); int total_lines = 0; int covered_lines = 0; buf.Text = File.ReadAllText (filename); foreach (var rec in recs) { RenderCoverage (buf, rec); total_lines += rec.GetLines().Length; covered_lines += rec.GetHits(); } double cov = (1.0 * covered_lines) / total_lines; page.SetCoverage (cov); notebook1.Page = notebook1.NPages - 1; sourceviews [filename] = sv; }
ScrolledWindow CreateView() { ScrolledWindow sw = new ScrolledWindow (); SourceView view = new SourceView (CreateBuffer ()); sw.Add (view); return sw; }
public SqlQueryView() : base() { control = new Frame (); control.Show (); VBox vbox = new VBox (); vbox.Show (); Tooltips tips = new Tooltips (); Toolbar toolbar = new Toolbar (); vbox.PackStart (toolbar, false, true, 0); toolbar.Show (); Image image = new Image (); image.Pixbuf = Gdk.Pixbuf.LoadFromResource ("MonoQuery.Execute"); image.Show (); Button execute = new Button (image); execute.Clicked += new EventHandler (OnExecute); execute.Relief = ReliefStyle.None; tips.SetTip (execute, "Execute", ""); toolbar.Add (execute); execute.Show (); image = new Image (); image.Pixbuf = Gdk.Pixbuf.LoadFromResource ("MonoQuery.RunFromCursor"); image.Show (); Button run = new Button (image); run.Clicked += new EventHandler (OnRunFromCursor); run.Relief = ReliefStyle.None; tips.SetTip (run, "Run from cursor", ""); toolbar.Add (run); run.Show (); image = new Image (); image.Pixbuf = Gdk.Pixbuf.LoadFromResource ("MonoQuery.Explain"); image.Show (); Button explain = new Button (image); explain.Clicked += new EventHandler (OnExplain); explain.Relief = ReliefStyle.None; tips.SetTip (explain, "Explain query", ""); toolbar.Add (explain); explain.Show (); image = new Image (); image.Pixbuf = Gdk.Pixbuf.LoadFromResource ("MonoQuery.Stop"); image.Show (); Button stop = new Button (image); stop.Clicked += new EventHandler (OnStop); stop.Relief = ReliefStyle.None; stop.Sensitive = false; tips.SetTip (stop, "Stop", ""); toolbar.Add (stop); stop.Show (); VSeparator sep = new VSeparator (); toolbar.Add (sep); sep.Show (); model = new ListStore (typeof (string), typeof (DbProviderBase)); providers = new ComboBox (); providers.Model = model; CellRendererText ctext = new CellRendererText (); providers.PackStart (ctext, true); providers.AddAttribute (ctext, "text", 0); toolbar.Add (providers); providers.Show (); SourceLanguagesManager lm = new SourceLanguagesManager (); SourceLanguage lang = lm.GetLanguageFromMimeType ("text/x-sql"); SourceBuffer buf = new SourceBuffer (lang); buf.Highlight = true; sourceView = new SourceView (buf); sourceView.ShowLineNumbers = true; sourceView.Show (); ScrolledWindow scroller = new ScrolledWindow (); scroller.Add (sourceView); scroller.Show (); vbox.PackStart (scroller, true, true, 0); control.Add (vbox); service = (MonoQueryService) ServiceManager.GetService (typeof (MonoQueryService)); changedHandler = (EventHandler) Runtime.DispatchService.GuiDispatch ( new EventHandler (OnProvidersChanged)); service.Providers.Changed += changedHandler; foreach (DbProviderBase p in service.Providers) { model.AppendValues (p.Name, p); } }
public DrawControlCharacterImp (SourceView view) { this.view = view; view.WidgetEventAfter += OnWidgetEvent; }