Skip to content

Instantly share code, notes, and snippets.

@laynor
Created Mar 24, 2016
Embed
What would you like to do?
import clr
clr.AddReference('Caliburn.Micro')
clr.AddReference('MesaGrid.Core')
clr.AddReferenceByName("PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")
clr.AddReferenceByName("PresentationCore, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")
import Caliburn.Micro as caliburn
import com.mesaideas.MesaGrid.ViewModels as viewModels
import com.mesaideas.MesaGrid.Core as core
from System import TimeSpan
from System.Windows.Media import Colors
def getShell():
caliburn.IoC.Get[viewModels.ShellViewModel]()
def reloadInit():
execfile(core.SharedConstants.ProductUserDirectory + r'\init.py')
def message(string, timeout=5000, color=Colors.Red):
statusbar = caliburn.IoC.Get[viewModels.StatusBarViewModel]()
statusbar.Message(string, TimeSpan.FromMilliseconds(timeout), color)
def newCommand(name, action, guard):
return viewModels.Commands.SimpleCommand(name, '', action, guard)
def switchToDocument(name):
items = [item for item in getShell().Items if item.DisplayName == name]
if items:
getShell().ActiveItem = items[0]
def currentEditor():
return getShell().ActiveItem
-
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment