예제 #1
0
 public ModelHelpers(IBackend gallifrey, FlyoutsControl flyoutsControl)
 {
     this.flyoutsControl = flyoutsControl;
     Gallifrey = gallifrey;
     DialogContext = new DialogContext();
     openFlyouts = new List<OpenFlyoutDetails>();
 }
예제 #2
0
        public EditTimerModel(IBackend gallifrey, Guid timerId)
        {
            var dateToday = DateTime.Now;
            var timer = gallifrey.JiraTimerCollection.GetTimer(timerId);

            UniqueId = timerId;
            JiraReference = timer.JiraReference;

            if (gallifrey.Settings.AppSettings.KeepTimersForDays > 0)
            {
                MinDate = dateToday.AddDays(gallifrey.Settings.AppSettings.KeepTimersForDays * -1);
                MaxDate = dateToday.AddDays(gallifrey.Settings.AppSettings.KeepTimersForDays);
            }
            else
            {
                MinDate = dateToday.AddDays(-300);
                MaxDate = dateToday.AddDays(300);
            }

            RunDate = timer.DateStarted;
            DisplayDate = timer.DateStarted;

            Hours = timer.ExactCurrentTime.Hours > 9 ? 9 : timer.ExactCurrentTime.Hours;
            Minutes = timer.ExactCurrentTime.Minutes;

            DateEditable = timer.HasExportedTime();
            JiraReferenceEditable = timer.HasExportedTime();
            TimeEditable = !timer.IsRunning;

            OriginalJiraReference = JiraReference;
            OriginalRunDate = RunDate;
            OriginalHours = Hours;
            OriginalMinutes = Minutes;
        }
예제 #3
0
        public SearchWindow(IBackend gallifrey)
        {
            this.gallifrey = gallifrey;
            InitializeComponent();

            try
            {
                cmbUserFilters.Items.Add(string.Empty);
                foreach (var jiraFilter in gallifrey.JiraConnection.GetJiraFilters())
                {
                    cmbUserFilters.Items.Add(jiraFilter);
                }
                cmbUserFilters.Enabled = true;
            }
            catch (NoResultsFoundException)
            {
                cmbUserFilters.Enabled = false;
            }

            try
            {
                var currentUserIssues = gallifrey.JiraConnection.GetJiraCurrentUserOpenIssues();
                lstResults.DataSource = currentUserIssues.Select(issue => new JiraSearchResult(issue)).ToList();
                lstResults.Enabled = true;
            }
            catch (NoResultsFoundException)
            {
                lstResults.Enabled = false;
                btnAddTimer.Enabled = false;
            }

            TopMost = gallifrey.Settings.UiSettings.AlwaysOnTop;
        }
예제 #4
0
 public AddTimerWindow(IBackend gallifrey)
 {
     this.gallifrey = gallifrey;
     InitializeComponent();
     calStartDate.MinDate = DateTime.Now.AddDays(gallifrey.AppSettings.KeepTimersForDays*-1);
     calStartDate.MaxDate = DateTime.Now.AddDays(gallifrey.AppSettings.KeepTimersForDays);
 }
예제 #5
0
        public SearchWindow(IBackend gallifrey)
        {
            this.gallifrey = gallifrey;
            InitializeComponent();

            try
            {
                cmbUserFilters.DataSource = gallifrey.JiraConnection.GetJiraFilters().ToList();
                cmbUserFilters.Enabled = true;
            }
            catch (NoResultsFoundException)
            {
                cmbUserFilters.Enabled = false;
            }

            try
            {
                var currentUserIssues = gallifrey.JiraConnection.GetJiraCurrentUserOpenIssues();
                lstResults.DataSource = currentUserIssues.Select(issue => new JiraSearchResult(issue)).ToList();
                lstResults.Enabled = true;
            }
            catch (NoResultsFoundException)
            {
                lstResults.Enabled = false;
            }
        }
예제 #6
0
        public void OnStart(IConfiguration config, IBackend backend)
        {
            this.backend = backend;

            var token = config[Constants.ConfigKey.DiffBotApiKey];

            this.apiEndPoint = "http://www.diffbot.com/api/article?summary&token=" + HttpUtility.UrlEncode(token);
        }
예제 #7
0
        public DuplicatiRemote(IConfigurationProvider configurationProvider)
        {
            this._configurationProvider = configurationProvider;

            string url = this._configurationProvider.DuplicatiUrl;
            string options = this._configurationProvider.DuplicatiOptions;
            _backend = BackendLoader.GetBackend(url, Duplicati.CommandLine.CommandLineParser.ExtractOptions(new List<string>(options.Split(' '))));
        }
        public AdjustTimerWindow(IBackend gallifrey, Guid timerGuid)
        {
            this.gallifrey = gallifrey;
            timerToShow = gallifrey.JiraTimerCollection.GetTimer(timerGuid);
            InitializeComponent();

            txtJiraRef.Text = timerToShow.JiraReference;
        }
예제 #9
0
		public void SetSource (IListDataSource source, IBackend sourceBackend)
		{
			var dataSource = sourceBackend as ListDataSource;
			if (dataSource != null)
				ComboBox.ItemsSource = dataSource;
			else
				ComboBox.ItemsSource = new ListSourceNotifyWrapper (source);
		}
예제 #10
0
파일: Wikipedia.cs 프로젝트: kfritz/Bender
 public void OnStart(IConfiguration config, IBackend backend)
 {
     this.backend = backend;
     if (!String.IsNullOrEmpty(config[Bender.Common.Constants.ConfigKey.WikipediaAlias]))
     {
         this.regexAlias = new Regex(String.Format(@"^\s*{0},?\s+(.+?)\s*$", config[Bender.Common.Constants.ConfigKey.WikipediaAlias]), RegexOptions.IgnoreCase);
     }
 }
예제 #11
0
        /////////////////////////////////////////////////////////////////////////////////

        private IGraph ImportModels(List<String> ecoreFilenames, String grgFilename, IBackend backend, out IActions actions)
        {
            foreach(String ecoreFilename in ecoreFilenames)
            {
                String modelText = ParseModel(ecoreFilename);

                String modelfilename = ecoreFilename.Substring(0, ecoreFilename.LastIndexOf('.')) + "__ecore.gm";

                // Do we have to update the model file (.gm)?
                if(!File.Exists(modelfilename) || File.GetLastWriteTime(ecoreFilename) > File.GetLastWriteTime(modelfilename))
                {
                    Console.WriteLine("Writing model file \"" + modelfilename + "\"...");
                    using(StreamWriter writer = new StreamWriter(modelfilename))
                        writer.Write(modelText);
                }
            }

            if(grgFilename == null)
            {
                grgFilename = "";
                foreach(String ecoreFilename in ecoreFilenames)
                    grgFilename += ecoreFilename.Substring(0, ecoreFilename.LastIndexOf('.')) + "_";
                grgFilename += "_ecore.grg";

                StringBuilder sb = new StringBuilder();
                sb.Append("// Automatically generated\n// Do not change, changes will be lost!\n\nusing ");

                DateTime grgTime;
                if(!File.Exists(grgFilename)) grgTime = DateTime.MinValue;
                else grgTime = File.GetLastWriteTime(grgFilename);

                bool mustWriteGrg = false;

                bool first = true;
                foreach(String ecore in ecoreFilenames)
                {
                    if(first) first = false;
                    else sb.Append(", ");
                    sb.Append(ecore.Substring(0, ecore.LastIndexOf('.')) + "__ecore");

                    if(File.GetLastWriteTime(ecore) > grgTime)
                        mustWriteGrg = true;
                }

                if(mustWriteGrg)
                {
                    sb.Append(";\n");
                    using(StreamWriter writer = new StreamWriter(grgFilename))
                        writer.Write(sb.ToString());
                }
            }

            IGraph graph;
            backend.CreateFromSpec(grgFilename, "defaultname", null,
                ProcessSpecFlags.UseNoExistingFiles, new List<String>(), 
                out graph, out actions);
            return graph;
        }
예제 #12
0
        public SettingsWindow(IBackend gallifrey)
        {
            this.gallifrey = gallifrey;
            InitializeComponent();

            if (gallifrey.Settings.JiraConnectionSettings.JiraUrl != null) txtJiraUrl.Text = gallifrey.Settings.JiraConnectionSettings.JiraUrl;
            if (gallifrey.Settings.JiraConnectionSettings.JiraUsername != null) txtJiraUsername.Text = gallifrey.Settings.JiraConnectionSettings.JiraUsername;
            if (gallifrey.Settings.JiraConnectionSettings.JiraPassword != null) txtJiraPassword.Text = gallifrey.Settings.JiraConnectionSettings.JiraPassword;

            chkAlert.Checked = gallifrey.Settings.AppSettings.AlertWhenNotRunning;
            chkAutoUpdate.Checked = gallifrey.Settings.AppSettings.AutoUpdate;
            txtAlertMins.Text = ((gallifrey.Settings.AppSettings.AlertTimeMilliseconds / 1000) / 60).ToString();
            txtTimerDays.Text = gallifrey.Settings.AppSettings.KeepTimersForDays.ToString();
            chkUsageTracking.Checked = gallifrey.Settings.AppSettings.UsageTracking;

            cmdDefaultExport.SelectedIndex = (int)gallifrey.Settings.ExportSettings.DefaultRemainingValue;
            txtCommentPrefix.Text = gallifrey.Settings.ExportSettings.ExportCommentPrefix;
            txtDefaultComment.Text = gallifrey.Settings.ExportSettings.EmptyExportComment;

            txtTargetHours.Text = gallifrey.Settings.AppSettings.TargetLogPerDay.Hours.ToString();
            txtTargetMins.Text = gallifrey.Settings.AppSettings.TargetLogPerDay.Minutes.ToString();

            for (var i = 0; i < chklstWorkingDays.Items.Count; i++)
            {
                var foundItem = gallifrey.Settings.AppSettings.ExportDays.Any(exportDay => exportDay.ToString().ToLower() == chklstWorkingDays.Items[i].ToString().ToLower());

                chklstWorkingDays.SetItemChecked(i, foundItem);
            }

            if (gallifrey.Settings.ExportSettings.ExportPrompt == null)
            {
                gallifrey.Settings.ExportSettings.ExportPrompt = new ExportPrompt();
            }

            for (var i = 0; i < chklstExportPrompt.Items.Count; i++)
            {
                switch (chklstExportPrompt.Items[i].ToString())
                {
                    case "Add Idle Time":
                        chklstExportPrompt.SetItemChecked(i, gallifrey.Settings.ExportSettings.ExportPrompt.OnAddIdle);
                        break;
                    case "Manual Timer Adjustment":
                        chklstExportPrompt.SetItemChecked(i, gallifrey.Settings.ExportSettings.ExportPrompt.OnManualAdjust);
                        break;
                    case "Stop Timer":
                        chklstExportPrompt.SetItemChecked(i, gallifrey.Settings.ExportSettings.ExportPrompt.OnStop);
                        break;
                    case "Add Pre-Loaded Timer":
                        chklstExportPrompt.SetItemChecked(i, gallifrey.Settings.ExportSettings.ExportPrompt.OnCreatePreloaded);
                        break;
                }
            }
            chkExportAll.Checked = gallifrey.Settings.ExportSettings.ExportPromptAll;

            cmdWeekStart.Text = gallifrey.Settings.AppSettings.StartOfWeek.ToString();

            chkAlwaysTop.Checked = gallifrey.Settings.UiSettings.AlwaysOnTop;
        }
예제 #13
0
파일: Extend.cs 프로젝트: kfritz/Bender
 public void OnStart(IConfiguration config, IBackend backend)
 {
     configuration = config;
     this.backend = backend;
     random = new Random();
     regexGetDll = new Regex(@"^\s*load library\s+(.+?)\s*$", RegexOptions.IgnoreCase);
     regexEnableModule = new Regex(@"^\s*enable module\s+(.+?)\s*$", RegexOptions.IgnoreCase);
     regexDisableModule = new Regex(@"^\s*disable module\s+(.+?)\s*$", RegexOptions.IgnoreCase);
 }
예제 #14
0
		public override void SetSource (IListDataSource source, IBackend sourceBackend)
		{
			base.SetSource (source, sourceBackend);

			source.RowInserted += HandleColumnSizeChanged;
			source.RowDeleted += HandleColumnSizeChanged;
			source.RowChanged += HandleColumnSizeChanged;
			ResetColumnSize (source);
		}
예제 #15
0
 public void SetSource(IListDataSource source, IBackend sourceBackend)
 {
     ListStoreBackend b = sourceBackend as ListStoreBackend;
     if (b == null) {
         CustomListModel model = new CustomListModel (source, Widget);
         Widget.Model = model.Store;
     } else
         Widget.Model = b.Store;
 }
예제 #16
0
 public void SetSource(ITreeDataSource source, IBackend sourceBackend)
 {
     TreeStoreBackend b = sourceBackend as TreeStoreBackend;
     if (b == null) {
         CustomTreeModel model = new CustomTreeModel (source);
         Widget.Model = model.Store;
     } else
         Widget.Model = b.Store;
 }
예제 #17
0
 public MainViewModel(IBackend gallifrey, MainWindow mainWindow)
 {
     Gallifrey = gallifrey;
     MainWindow = mainWindow;
     TimerDates = new ObservableCollection<TimerDateModel>();
     runningWatcher = new Timer(1000);
     runningWatcher.Elapsed += runningWatcherElapsed;
     Gallifrey.VersionControl.PropertyChanged += VersionControlPropertyChanged;
 }
예제 #18
0
        public ChangeLogWindow(IBackend gallifrey, IDictionary<Version, ChangeLogVersionDetails> changeLog)
        {
            InitializeComponent();

            lblCurrentVersion.Text = string.Format("Current Version: {0}", gallifrey.VersionControl.VersionName);

            foreach (var changeLogDetail in changeLog)
            {
                txtChangeLog.SelectionFont = new Font(txtChangeLog.SelectionFont.FontFamily, 14, FontStyle.Bold);
                if (string.IsNullOrWhiteSpace(changeLogDetail.Value.Name))
                {
                    txtChangeLog.AppendText(string.Format("Version: {0}\n", changeLogDetail.Key));
                }
                else
                {
                    txtChangeLog.AppendText(string.Format("Version: {0} ({1})\n", changeLogDetail.Key, changeLogDetail.Value.Name));
                }

                if (changeLogDetail.Value.Features.Any())
                {
                    txtChangeLog.SelectionFont = new Font(txtChangeLog.SelectionFont.FontFamily, 12, FontStyle.Underline);
                    txtChangeLog.AppendText("New Features\n");
                    txtChangeLog.SelectionFont = new Font(txtChangeLog.SelectionFont.FontFamily, 10, FontStyle.Regular);
                    foreach (var feature in changeLogDetail.Value.Features)
                    {
                        txtChangeLog.AppendText(string.Format("  => {0}\n", feature));
                    }
                }

                if (changeLogDetail.Value.Bugs.Any())
                {
                    txtChangeLog.SelectionFont = new Font(txtChangeLog.SelectionFont.FontFamily, 12, FontStyle.Underline);
                    txtChangeLog.AppendText("Bug Fixes\n");
                    txtChangeLog.SelectionFont = new Font(txtChangeLog.SelectionFont.FontFamily, 10, FontStyle.Regular);
                    foreach (var feature in changeLogDetail.Value.Bugs)
                    {
                        txtChangeLog.AppendText(string.Format("  => {0}\n", feature));
                    }
                }

                if (changeLogDetail.Value.Others.Any())
                {
                    txtChangeLog.SelectionFont = new Font(txtChangeLog.SelectionFont.FontFamily, 12, FontStyle.Underline);
                    txtChangeLog.AppendText("Other Items\n");
                    txtChangeLog.SelectionFont = new Font(txtChangeLog.SelectionFont.FontFamily, 10, FontStyle.Regular);
                    foreach (var feature in changeLogDetail.Value.Others)
                    {
                        txtChangeLog.AppendText(string.Format("  => {0}\n", feature));
                    }
                }

                txtChangeLog.AppendText("\n");
            }

            txtChangeLog.Select(0,0);
        }
예제 #19
0
        public RenameTimerWindow(IBackend gallifrey, Guid timerGuid)
        {
            this.gallifrey = gallifrey;
            timerToShow = gallifrey.JiraTimerCollection.GetTimer(timerGuid);
            InitializeComponent();

            txtJiraRef.Text = timerToShow.JiraReference;
            calStartDate.Value = timerToShow.DateStarted.Date;
            txtJiraRef.Enabled = timerToShow.HasExportedTime();
        }
예제 #20
0
        public BackendRepos(IBackend backend)
        {
            if (backend == null)
                throw new ArgumentNullException ("backend");

            TaskListRepository = backend.TaskListRepository;
            TaskRepository = backend.TaskRepository;
            NoteRepository = backend.NoteRepository;

            TaskObjectManager = new TaskObjectManager ();
        }
예제 #21
0
 /// <summary>
 /// Creates a new graph from the given ECore metamodels.
 /// If a grg file is given, the graph will use the graph model declared in it and the according
 /// actions object will be associated to the graph.
 /// If a xmi file is given, the model instance will be imported into the graph.
 /// Any errors will be reported by exception.
 /// </summary>
 /// <param name="backend">The backend to use to create the graph.</param>
 /// <param name="ecoreFilenames">A list of ECore model specification files. It must at least contain one element.</param>
 /// <param name="grgFilename">A grg file to be used to create the graph, or null.</param>
 /// <param name="xmiFilename">The filename of the model instance to be imported, or null.</param>
 /// <param name="noPackageNamePrefix">Prefix the types with the name of the package? Can only be used if names from the packages are disjoint.</param>
 /// <param name="actions">Receives the actions object in case a .grg model is given.</param>
 public static IGraph Import(IBackend backend, List<String> ecoreFilenames, String grgFilename, String xmiFilename, bool noPackageNamePrefix, out IActions actions)
 {
     ECoreImport imported = new ECoreImport();
     imported.graph = imported.ImportModels(ecoreFilenames, grgFilename, backend, out actions);
     if(xmiFilename != null)
     {
         Console.WriteLine("Importing graph...");
         imported.ImportGraph(xmiFilename);
     }
     return imported.graph;
 }
예제 #22
0
        public LockedTimerWindow(IBackend gallifrey)
        {
            DisplayForm = true;
            this.gallifrey = gallifrey;
            InitializeComponent();

            BindIdleTimers();
            SetRunningTimer();
            BindRecentTimers();

            TopMost = gallifrey.Settings.UiSettings.AlwaysOnTop;
        }
예제 #23
0
        public AboutWindow(IBackend gallifrey)
        {
            this.gallifrey = gallifrey;
            InitializeComponent();
            lblCurrentVersion.Text = string.Format("Current Version: {0}", gallifrey.VersionControl.VersionName);

            contributors = new List<string>()
                {
                    "Mark Harrison\nTwitter: @HarrisonMeister\nGitHub: @HarrisonMeister",
                };

            btnChangeLog.Visible = gallifrey.VersionControl.IsAutomatedDeploy;
        }
예제 #24
0
        public InformationModel(IBackend gallifrey)
        {
            var contributorTimer = new Timer(1000);
            contributorTimer.Elapsed += ContributorTimerOnElapsed;
            contributorTimer.Start();

            contributorList = gallifrey.WithThanksDefinitions.Select(BuildThanksString).ToList();

            position = 0;
            Contributors = contributorList[position];

            InstallationId = gallifrey.Settings.InternalSettings.InstallationInstaceId.ToString();
        }
예제 #25
0
        public AddTimerWindow(IBackend gallifrey)
        {
            DisplayForm = true;
            this.gallifrey = gallifrey;
            InitializeComponent();
            calStartDate.MinDate = DateTime.Now.AddDays(gallifrey.Settings.AppSettings.KeepTimersForDays * -1);
            calStartDate.MaxDate = DateTime.Now.AddDays(gallifrey.Settings.AppSettings.KeepTimersForDays);

            txtJiraRef.AutoCompleteCustomSource.AddRange(gallifrey.JiraConnection.GetJiraProjects().Select(x => x.ToString()).ToArray());
            showingJiras = false;

            TopMost = gallifrey.Settings.UiSettings.AlwaysOnTop;
        }
예제 #26
0
        public App(IBackend backend, Router router)
        {
            _backend = backend;
            _rootRouter = router;

            var assembly = Assembly.GetExecutingAssembly();
            Template.RegisterTag<Tags.StaticTag>("static");
            Template.FileSystem = new EmbeddedFileSystem(assembly, "Memorandum.Web.Templates");
            Template.NamingConvention = new CSharpNamingConvention();
            Template.RegisterFilter(typeof (Filters));

            ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
        }
예제 #27
0
 /// <summary>
 /// Constructs the backend using environment variables and
 /// settings to determine the best fit.
 /// </summary>
 public Graphics()
 {
     // Set the backend
     if (System.Environment.OSVersion.Platform == System.PlatformID.Unix)
     {
         // SDL seems to work better under Unix
         backend = new BooGame.Sdl.SdlBackend();
     }
     else
     {
         // FreeGlut has been behaving better under Windows.
         backend = new BooGame.FreeGlut.FreeGlutBackend();
     }
 }
예제 #28
0
        private void SetBackend(IBackend value)
        {
            bool changingBackend = false;

            if (this.backend != null)
            {
                UnhookFromTooltipTaskGroupModels();
                changingBackend = true;
                // Cleanup the old backend
                try {
                    Logger.Debug("Cleaning up backend: {0}",
                                 this.backend.Name);
                    this.backend.Cleanup();
                } catch (Exception e) {
                    Logger.Warn("Exception cleaning up '{0}': {1}",
                                this.backend.Name,
                                e);
                }
            }

            // Initialize the new backend
            this.backend = value;
            if (this.backend == null)
            {
                RefreshTrayIconTooltip();
                return;
            }

            Logger.Info("Using backend: {0} ({1})",
                        this.backend.Name,
                        this.backend.GetType().ToString());
            this.backend.Initialize();

            if (!changingBackend)
            {
                TaskWindow.Reinitialize(!this.quietStart);
            }
            else
            {
                TaskWindow.Reinitialize(true);
            }

            RebuildTooltipTaskGroupModels();
            RefreshTrayIconTooltip();

            Logger.Debug("Configuration status: {0}",
                         this.backend.Configured.ToString());
        }
예제 #29
0
파일: Porter.cs 프로젝트: jblomer/GrGen.NET
 /// <summary>
 /// Imports a graph from the given file.
 /// The format is determined by the file extension.
 /// Any errors will be reported by exception.
 /// </summary>
 /// <param name="importFilename">The filename of the file to be imported,
 ///     the model specification part will be ignored.</param>
 /// <param name="backend">The backend to use to create the graph.</param>
 /// <param name="graphModel">The graph model to be used,
 ///     it must be conformant to the model used in the file to be imported.</param>
 /// <param name="actions">Receives the actions object in case a .grg model is given.</param>
 /// <returns>The imported graph.
 /// The .grs/.grsi importer returns an INamedGraph. If you don't need it: create an LGSPGraph from it and throw the named graph away.
 /// (the naming requires about the same amount of memory the raw graph behind it requires).</returns>
 public static IGraph Import(String importFilename, IBackend backend, IGraphModel graphModel, out IActions actions)
 {
     if (importFilename.EndsWith(".gxl", StringComparison.InvariantCultureIgnoreCase))
     {
         return(GXLImport.Import(importFilename, backend, graphModel, out actions));
     }
     else if (importFilename.EndsWith(".grs", StringComparison.InvariantCultureIgnoreCase) ||
              importFilename.EndsWith(".grsi", StringComparison.InvariantCultureIgnoreCase))
     {
         return(GRSImport.Import(importFilename, backend, graphModel, out actions));
     }
     else
     {
         throw new NotSupportedException("File format not supported");
     }
 }
예제 #30
0
        public SettingsWindow(IBackend gallifrey)
        {
            this.gallifrey = gallifrey;
            InitializeComponent();

            if (gallifrey.JiraConnectionSettings.JiraUrl != null) txtJiraUrl.Text = gallifrey.JiraConnectionSettings.JiraUrl;
            if (gallifrey.JiraConnectionSettings.JiraUsername != null) txtJiraUsername.Text = gallifrey.JiraConnectionSettings.JiraUsername;
            if (gallifrey.JiraConnectionSettings.JiraPassword != null) txtJiraPassword.Text = gallifrey.JiraConnectionSettings.JiraPassword;

            chkAlert.Checked = gallifrey.AppSettings.AlertWhenNotRunning;
            txtAlertMins.Text = ((gallifrey.AppSettings.AlertTimeMilliseconds / 1000) / 60).ToString();
            txtTimerDays.Text = gallifrey.AppSettings.KeepTimersForDays.ToString();

            txtTargetHours.Text = gallifrey.AppSettings.TargetLogPerDay.Hours.ToString();
            txtTargetMins.Text = gallifrey.AppSettings.TargetLogPerDay.Minutes.ToString();
        }
예제 #31
0
        public EditTimerWindow(IBackend gallifrey, Guid timerGuid)
        {
            this.gallifrey = gallifrey;
            timerToShow = gallifrey.JiraTimerCollection.GetTimer(timerGuid);
            InitializeComponent();

            txtJiraRef.AutoCompleteCustomSource.AddRange(gallifrey.JiraConnection.GetJiraProjects().Select(x => x.ToString()).ToArray());
            showingJiras = false;
            txtJiraRef.Text = timerToShow.JiraReference;

            calStartDate.Value = timerToShow.DateStarted.Date;

            txtJiraRef.Enabled = timerToShow.HasExportedTime();
            calStartDate.Enabled = timerToShow.HasExportedTime();

            TopMost = gallifrey.Settings.UiSettings.AlwaysOnTop;
        }
예제 #32
0
        public EditTimerModel(IBackend gallifrey, Guid timerId)
        {
            var dateToday = DateTime.Now;
            var timer = gallifrey.JiraTimerCollection.GetTimer(timerId);

            if (gallifrey.Settings.AppSettings.KeepTimersForDays > 0)
            {
                MinDate = dateToday.AddDays(gallifrey.Settings.AppSettings.KeepTimersForDays * -1);
                MaxDate = dateToday.AddDays(gallifrey.Settings.AppSettings.KeepTimersForDays);
            }
            else
            {
                MinDate = dateToday.AddDays(-300);
                MaxDate = dateToday.AddDays(300);
            }

            RunDate = timer.DateStarted;
            DisplayDate = timer.DateStarted;

            Hours = timer.ExactCurrentTime.Hours > 9 ? 9 : timer.ExactCurrentTime.Hours;
            Minutes = timer.ExactCurrentTime.Minutes;

            hasExportedTime = timer.HasExportedTime();
            TimeEditable = !timer.IsRunning;

            LocalTimer = timer.LocalTimer;

            if (LocalTimer)
            {
                LocalTimerDescription = timer.JiraName;
                JiraReference = string.Empty;
            }
            else
            {
                JiraReference = timer.JiraReference;
                LocalTimerDescription = string.Empty;
            }

            OriginalLocalTimerDescription = LocalTimerDescription;
            OriginalJiraReference = JiraReference;
            OriginalRunDate = RunDate;
            OriginalHours = Hours ?? 0;
            OriginalMinutes = Minutes ?? 0;

            IsDefaultOnButton = true;
        }
예제 #33
0
        private void buttonStartGame_Click(object sender, RoutedEventArgs e)
        {
            _backend = new Backend();
            var scenario = GenerateScenario();

            _backend.Setup(scenario.Item1, scenario.Item2);
            string word   = _backend.GetWord();
            string wordUI = "";

            foreach (var c in word)
            {
                wordUI += " _";
            }
            labelWord.Content = wordUI;
            UpdateAttemptsLeft();
            _gameRunning = true;
        }
예제 #34
0
    static object Runtime(IBackend addon, string more = null)
    {
        var need = addon as INeed;

        if (need != null)
        {
            need.Input = more;
        }
        addon.Execute();
        var give = addon as IGive;

        if (give != null)
        {
            return(give.Output);
        }
        return(null);
    }
예제 #35
0
        public AddTimerModel(IBackend gallifrey, string jiraRef, DateTime?startDate, bool?enableDateChange, List <IdleTimer> idleTimers, bool?startNow)
        {
            var dateToday = DateTime.Now;

            JiraReference         = jiraRef;
            JiraReferenceEditable = string.IsNullOrWhiteSpace(jiraRef);

            if (gallifrey.Settings.AppSettings.KeepTimersForDays > 0)
            {
                MinDate = dateToday.AddDays(gallifrey.Settings.AppSettings.KeepTimersForDays * -1);
                MaxDate = dateToday.AddDays(gallifrey.Settings.AppSettings.KeepTimersForDays);
            }
            else
            {
                MinDate = dateToday.AddDays(-300);
                MaxDate = dateToday.AddDays(300);
            }

            if (!startDate.HasValue)
            {
                startDate = dateToday;
            }

            if (startDate.Value < MinDate || startDate.Value > MaxDate)
            {
                DisplayDate = dateToday;
                StartDate   = dateToday;
            }
            else
            {
                DisplayDate = startDate.Value;
                StartDate   = startDate.Value;
            }

            DateEditable = !enableDateChange.HasValue || enableDateChange.Value;
            StartNow     = startNow.HasValue && startNow.Value;

            if (idleTimers != null && idleTimers.Any())
            {
                var preloadTime = new TimeSpan();
                preloadTime  = idleTimers.Aggregate(preloadTime, (current, idleTimer) => current.Add(idleTimer.IdleTimeValue));
                StartHours   = preloadTime.Hours > 9 ? 9 : preloadTime.Hours;
                StartMinutes = preloadTime.Minutes;
                IdleTimers   = idleTimers;
            }
        }
예제 #36
0
        public EditTimerWindow(IBackend gallifrey, Guid timerGuid)
        {
            this.gallifrey = gallifrey;
            timerToShow    = gallifrey.JiraTimerCollection.GetTimer(timerGuid);
            InitializeComponent();

            txtJiraRef.AutoCompleteCustomSource.AddRange(gallifrey.JiraConnection.GetJiraProjects().Select(x => x.ToString()).ToArray());
            showingJiras    = false;
            txtJiraRef.Text = timerToShow.JiraReference;

            calStartDate.Value = timerToShow.DateStarted.Date;

            txtJiraRef.Enabled   = timerToShow.HasExportedTime();
            calStartDate.Enabled = timerToShow.HasExportedTime();

            TopMost = gallifrey.Settings.UiSettings.AlwaysOnTop;
        }
예제 #37
0
 public static void SetDefaultFactory(IBackend backend)
 {
     lock (_syncRoot)
     {
         if (_factory == null)
         {
             _factory = new PromiseFactory(backend);
             _backend = backend;
         }
         else if (!Object.Equals(_backend, backend))
         {
             _factory.Dispose();
             _factory = new PromiseFactory(backend);
             _backend = backend;
         }
     }
 }
예제 #38
0
        public EditTimerModel(IBackend gallifrey, Guid timerId)
        {
            var dateToday = DateTime.Now;
            var timer     = gallifrey.JiraTimerCollection.GetTimer(timerId);

            if (gallifrey.Settings.AppSettings.KeepTimersForDays > 0)
            {
                MinDate = dateToday.AddDays(gallifrey.Settings.AppSettings.KeepTimersForDays * -1);
                MaxDate = dateToday.AddDays(gallifrey.Settings.AppSettings.KeepTimersForDays);
            }
            else
            {
                MinDate = dateToday.AddDays(-300);
                MaxDate = dateToday.AddDays(300);
            }

            RunDate     = timer.DateStarted;
            DisplayDate = timer.DateStarted;

            Hours   = timer.ExactCurrentTime.Hours > 9 ? 9 : timer.ExactCurrentTime.Hours;
            Minutes = timer.ExactCurrentTime.Minutes;

            hasExportedTime = timer.HasExportedTime();
            TimeEditable    = !timer.IsRunning;

            LocalTimer = timer.LocalTimer;

            if (LocalTimer)
            {
                LocalTimerDescription = timer.JiraName;
                JiraReference         = string.Empty;
            }
            else
            {
                JiraReference         = timer.JiraReference;
                LocalTimerDescription = string.Empty;
            }

            OriginalLocalTimerDescription = LocalTimerDescription;
            OriginalJiraReference         = JiraReference;
            OriginalRunDate = RunDate;
            OriginalHours   = Hours ?? 0;
            OriginalMinutes = Minutes ?? 0;

            IsDefaultOnButton = true;
        }
예제 #39
0
        public void SetSource(ITreeDataSource source, IBackend sourceBackend)
        {
            this.source = source;
            RowHeights.Clear();
            tsource         = new TreeSource(source);
            Tree.DataSource = tsource;

            source.NodeInserted += (sender, e) => Tree.ReloadItem(tsource.GetItem(source.GetParent(e.Node)), true);
            source.NodeDeleted  += (sender, e) => Tree.ReloadItem(tsource.GetItem(e.Node), true);
            source.NodeChanged  += (sender, e) => {
                var item = tsource.GetItem(e.Node);
                Tree.ReloadItem(item, false);
                UpdateRowHeight(item);
            };
            source.NodesReordered += (sender, e) => Tree.ReloadItem(tsource.GetItem(e.Node), true);
            source.Cleared        += (sender, e) => Tree.ReloadData();
        }
        public bool TryCreateBackend(string outputType, string outputFile, out IBackend backend)
        {
            if (String.IsNullOrEmpty(outputType))
            {
                outputType = Path.GetExtension(outputFile);
            }

            switch (outputType.ToLowerInvariant())
            {
            case "bundle":
            case ".exe":
                backend = new BundleBackend();
                return(true);
            }

            backend = null;
            return(false);
        }
예제 #41
0
 public DapAccessLink(string unique_id, IBackend backend_interface = null)
 {
     // super(DAPAccessCMSISDAP, this).@__init__();
     this._backend_interface    = backend_interface;
     this._deferred_transfer    = false;
     this._protocol             = null;
     this._packet_count         = null;
     this._unique_id            = unique_id;
     this._frequency            = 1000000;
     this._dap_port             = null;
     this._transfer_list        = null;
     this._crnt_cmd             = null;
     this._packet_size          = null;
     this._commands_to_read     = null;
     this._command_response_buf = null;
     //this._logger = logging.getLogger(@__name__);
     return;
 }
예제 #42
0
        private List <IBackend> GetBackendsFromAssembly(Assembly asm)
        {
            List <IBackend> backends = new List <IBackend> ();

            Type[] types = null;

            try {
                types = asm.GetTypes();
            } catch (Exception e) {
                Logger.Warn("Exception reading types from assembly '{0}': {1}",
                            asm.ToString(), e.Message);
                return(backends);
            }
            foreach (Type type in types)
            {
                if (!type.IsClass)
                {
                    continue;                     // Skip non-class types
                }
                if (type.GetInterface("Tasque.Backends.IBackend") == null)
                {
                    continue;
                }
                Logger.Debug("Found Available Backend: {0}", type.ToString());

                IBackend availableBackend = null;
                try {
                    availableBackend = (IBackend)
                                       asm.CreateInstance(type.ToString());
                } catch (Exception e) {
                    Logger.Warn("Could not instantiate {0}: {1}",
                                type.ToString(),
                                e.Message);
                    continue;
                }

                if (availableBackend != null)
                {
                    backends.Add(availableBackend);
                }
            }

            return(backends);
        }
예제 #43
0
        public ExportTimerWindow(IBackend gallifrey, Guid timerGuid)
        {
            this.gallifrey = gallifrey;
            timerToShow    = gallifrey.JiraTimerCollection.GetTimer(timerGuid);
            InitializeComponent();

            jiraIssue = gallifrey.JiraConnection.GetJiraIssue(timerToShow.JiraReference);
            var loggedTime = new TimeSpan();

            foreach (var worklog in jiraIssue.GetWorklogs())
            {
                if (worklog.StartDate.HasValue && worklog.StartDate.Value.Date == timerToShow.DateStarted.Date && worklog.Author.ToLower() == gallifrey.JiraConnectionSettings.JiraUsername.ToLower())
                {
                    loggedTime = loggedTime.Add(new TimeSpan(0, 0, (int)worklog.TimeSpentInSeconds));
                }
            }
            gallifrey.JiraTimerCollection.SetJiraExportedTime(timerGuid, loggedTime);

            timerToShow = gallifrey.JiraTimerCollection.GetTimer(timerGuid);

            if (timerToShow.TimeToExport.TotalMinutes <= 0)
            {
                MessageBox.Show("There Is No Time To Export", "Nothing To Export", MessageBoxButtons.OK, MessageBoxIcon.Information);
                DisplayForm = false;
            }

            txtJiraRef.Text       = timerToShow.JiraReference;
            txtDescription.Text   = timerToShow.JiraName;
            txtTotalHours.Text    = timerToShow.ExactCurrentTime.Hours.ToString();
            txtTotalMinutes.Text  = timerToShow.ExactCurrentTime.Minutes.ToString();
            txtExportedHours.Text = timerToShow.ExportedTime.Hours.ToString();
            txtExportedMins.Text  = timerToShow.ExportedTime.Minutes.ToString();
            txtExportHours.Text   = timerToShow.TimeToExport.Hours.ToString();
            txtExportMins.Text    = timerToShow.TimeToExport.Minutes.ToString();

            if (timerToShow.DateStarted.Date != DateTime.Now.Date)
            {
                calExportDate.Value = timerToShow.DateStarted.Date.AddHours(12);
            }
            else
            {
                calExportDate.Value = DateTime.Now;
            }
        }
예제 #44
0
        public AddTimerModel(IBackend gallifrey, string jiraRef, DateTime?startDate, bool?enableDateChange, TimeSpan?preloadTime, bool?startNow)
        {
            var dateToday = DateTime.Now;

            JiraReference         = jiraRef;
            JiraReferenceEditable = string.IsNullOrWhiteSpace(jiraRef);

            if (gallifrey.Settings.AppSettings.KeepTimersForDays > 0)
            {
                MinDate = dateToday.AddDays(gallifrey.Settings.AppSettings.KeepTimersForDays * -1);
                MaxDate = dateToday.AddDays(gallifrey.Settings.AppSettings.KeepTimersForDays);
            }
            else
            {
                MinDate = dateToday.AddDays(-300);
                MaxDate = dateToday.AddDays(300);
            }

            if (!startDate.HasValue)
            {
                startDate = dateToday;
            }

            if (startDate.Value < MinDate || startDate.Value > MaxDate)
            {
                DisplayDate = dateToday;
                StartDate   = dateToday;
            }
            else
            {
                DisplayDate = startDate.Value;
                StartDate   = startDate.Value;
            }

            DateEditable = !enableDateChange.HasValue || enableDateChange.Value;

            if (preloadTime.HasValue)
            {
                StartHours   = preloadTime.Value.Hours > 9 ? 9 : preloadTime.Value.Hours;
                StartMinutes = preloadTime.Value.Minutes;
            }

            StartNow = startNow.HasValue && startNow.Value;
        }
예제 #45
0
        /// <summary>
        /// https://github.com/taki0112/Spectral_Normalization-Tensorflow
        /// </summary>
        /// <param name="b"></param>
        /// <param name="w">the weight to be normalized. It need to be at least 2D</param>
        /// <param name="iteration"></param>
        /// <returns>normalized weight</returns>
        public static Tensor spectral_norm(this IBackend b, Tensor w, int iteration = 1)
        {
            using (b.name_scope("SpectralNormalization" + b.get_uid("SpectralNormalization")))
            {
                var wShape = w.shape;
                var uShape = new int[] { 1, wShape[wShape.Length - 1].Value };
                w = b.reshape(w, new int[2] {
                    -1, wShape[wShape.Length - 1].Value
                });

                var initailzer = new Initializers.RandomNormal();
                var u          = b.variable(tensor: initailzer.Call(uShape), name: "U");

                Tensor uHat = u;
                Tensor vHat = null;

                for (int i = 0; i < iteration; ++i)
                {
                    // power iteration
                    //Usually iteration = 1 will be enough
                    var v_ = b.dot(uHat, b.transpose(w, new int[] { 1, 0 }));
                    vHat = b.l2_normalize(v_, 1);

                    var u_ = b.dot(vHat, w);
                    uHat = b.l2_normalize(u_, 1);
                }

                uHat = b.stop_gradient(uHat);
                vHat = b.stop_gradient(vHat);

                var sigma = b.dot(b.dot(vHat, w), b.transpose(uHat, new int[] { 1, 0 }));

                var update = b.update(u, uHat);

                Tensor wNorm = null;
                using (b.dependency(update))
                {
                    wNorm = w / sigma;
                    wNorm = b.reshape(wNorm, wShape.Select(x => x.Value).ToArray());
                }

                return(wNorm);
            }
        }
예제 #46
0
        public IdleTimerWindow(IBackend gallifrey)
        {
            this.gallifrey = gallifrey;
            InitializeComponent();

            BindIdleTimers();

            runningTimerId = gallifrey.JiraTimerCollection.GetRunningTimerId();

            if (runningTimerId.HasValue)
            {
                lblRunning.Text = gallifrey.JiraTimerCollection.GetTimer(runningTimerId.Value).ToString();
            }
            else
            {
                lblRunning.Text    = "N/A";
                radRunning.Enabled = false;
            }
        }
예제 #47
0
 protected void LoadBackend()
 {
     if (usingCustomBackend)
     {
         usingCustomBackend = false;
         backend.Initialize(this);
         OnBackendCreated();
     }
     else if (backend == null)
     {
         backend = OnCreateBackend();
         if (backend == null)
         {
             throw new InvalidOperationException("No backend found for widget: " + GetType());
         }
         backend.Initialize(this);
         OnBackendCreated();
     }
 }
예제 #48
0
        public DefaultGui(IBackend backend) : base()
        {
            if (backend == null)
            {
                throw new ArgumentNullException("invalid value for 'backend': null");
            }
            this.ba    = backend;
            myDelegate = new AddListItem(repaint);
            InitializeComponent();
            // we usually don't have a console in a form-project. This enables us to see debug-output anyway
            AllocConsole();
            this.board.Paint        += board_PaintMap;
            this.board.Paint        += board_PaintEntities;
            this.chatInput.KeyPress += chat_KeyPress;
            this.board.KeyPress     += board_KeyPress;

            int map_XKoord = backend.getTilesOfMap()[0].Length;
            int map_YKoord = backend.getTilesOfMap().Length;
        }
예제 #49
0
 public Group(
     IResourceGroup resourceGroup,
     IBackend backend,
     ILog logger,
     List <Setting> settings,
     NotificationDelay notificationDelay,
     string subscriptionId,
     IEnumerable <LocationTZ> timezones,
     DateTime timeNowUtc
     )
 {
     this.resourceGroup     = resourceGroup;
     this._backend          = backend;
     this._logger           = logger;
     this.settings          = settings;
     this.notificationDelay = notificationDelay;
     this.subscriptionId    = subscriptionId;
     this.timezones         = timezones;
     this.timeNowUtc        = timeNowUtc;
 }
예제 #50
0
        public MainWindow()
        {
            InitializeComponent();
            gallifrey = new Backend();
            try
            {
                gallifrey.Initialise();
            }
            catch (MissingJiraConfigException)
            {
                btnSettings_Click(null, null);
            }
            catch (JiraConnectionException)
            {
                btnSettings_Click(null, null);
            }

            gallifrey.NoActivityEvent  += GallifreyOnNoActivityEvent;
            SystemEvents.SessionSwitch += SessionSwitchHandler;
        }
예제 #51
0
파일: Services.cs 프로젝트: limocute/yak2d
 public Services(IBackend backend,
                 IDisplay display,
                 IFps fps,
                 IStages stages,
                 IInput input,
                 ISurfaces surfaces,
                 ICameras cameras,
                 IFonts fonts,
                 IHelpers helpers)
 {
     Backend  = backend;
     Display  = display;
     FPS      = fps;
     Stages   = stages;
     Input    = input;
     Surfaces = surfaces;
     Cameras  = cameras;
     Fonts    = fonts;
     Helpers  = helpers;
 }
예제 #52
0
        /// <summary>
        /// Imports the first graph not being of type "gxl-1.0" from the given text reader input stream.
        /// Any errors will be reported by exception.
        /// </summary>
        /// <param name="inStream">The text reader input stream import source.</param>
        /// <param name="backend">The backend to use to create the graph.</param>
        /// <param name="graphModel">The graph model to be used,
        ///     it must be conformant to the model used in the file to be imported.</param>
        /// <param name="actions">Receives the actions object in case a .grg model is given.</param>
        public static IGraph Import(TextReader inStream, IBackend backend, IGraphModel graphModel, out IActions actions)
        {
            XmlDocument doc = new XmlDocument();

            doc.Load(inStream);

            XmlElement gxlelem = doc["gxl"];

            if (gxlelem == null)
            {
                throw new Exception("The document has no gxl element.");
            }

            XmlElement graphelem = null;
            String     graphtype = null;

            foreach (XmlElement curgraphnode in gxlelem.GetElementsByTagName("graph"))
            {
                graphtype = GetTypeName(curgraphnode);
                if (!graphtype.EndsWith("gxl-1.0.gxl#gxl-1.0"))
                {
                    if (graphelem != null)
                    {
                        throw new Exception("More than one instance graph included (not yet supported)!");
                    }
                    graphelem = curgraphnode;
                }
            }
            if (graphelem == null)
            {
                throw new Exception("No non-meta graph found!");
            }

            String graphname = graphelem.GetAttribute("id");
            IGraph graph     = backend.CreateGraph(graphModel, graphname);

            ImportGraph(graph, doc, graphelem);

            actions = null;
            return(graph);
        }
예제 #53
0
        public BackendHandler(Options options, string backendUrl, DatabaseCommon database, StatsCollector stats, ITaskReader taskreader)
            : base()
        {
            m_backendurl = backendUrl;
            m_database   = database;
            m_options    = options;
            m_backendurl = backendUrl;
            m_stats      = stats;
            m_taskreader = taskreader;
            m_backend    = DynamicLoader.BackendLoader.GetBackend(backendUrl, options.RawOptions);

            var shortname = m_backendurl;

            // Try not to leak hostnames or other information in the error messages
            try { shortname = new Library.Utility.Uri(shortname).Scheme; }
            catch { }

            if (m_backend == null)
            {
                throw new Duplicati.Library.Interface.UserInformationException(string.Format("Backend not supported: {0}", shortname), "BackendNotSupported");
            }
        }
예제 #54
0
        public bool TryCreateBackend(string outputType, string outputFile, out IBackend backend)
        {
            if (String.IsNullOrEmpty(outputType))
            {
                outputType = Path.GetExtension(outputFile);
            }

            switch (outputType?.ToLowerInvariant())
            {
            case "module":
            case ".msm":
                backend = new MsmBackend();
                return(true);

            case "msipackage":
            case "package":
            case "product":
            case ".msi":
                backend = new MsiBackend();
                return(true);

            case "patch":
            case ".msp":
                backend = new MspBackend();
                return(true);

            //case "patchcreation":
            //case ".pcp":
            //    return new PatchCreationBackend();

            case "transform":
            case ".mst":
                backend = new MstBackend();
                return(true);
            }

            backend = null;
            return(false);
        }
        private static IEnumerable <IBackend> GetBackends(IConfigurationSection config)
        {
            var backendsConfig = config.GetSection("Backends");

            if (backendsConfig == null)
            {
                throw new Exception("BackendSplicer.Backends configuration section not found");
            }

            var backends = new List <BackendConfig>();

            backendsConfig.Bind(backends);

            foreach (BackendConfig backendConfig in backends)
            {
                IBackend backend = null;
                if (backendConfig.Type == "regex")
                {
                    backend = new RegexBackend(backendConfig.Data["hostname"], backendConfig.Data["match"], backendConfig.Data["replace"]);
                }
                else if (backendConfig.Type == "plugin")
                {
                    Type pluginType = Type.GetType(backendConfig.ClassName, false, true);
                    if (pluginType == null)
                    {
                        throw new Exception($"Couldn't find plugin type: {backendConfig.ClassName}");
                    }

                    backend = new PluginBackend(pluginType, backendConfig.Data);
                }
                else
                {
                    throw new Exception($"backend configuration type {backendConfig.Type} not valid");
                }

                yield return(backend);
            }
        }
예제 #56
0
        public OptionsScreen(Options opts, List <IBackend> backends)
        {
            InitializeComponent();
            m_InitialOpts = opts;
            PopulateGUIFromOptions(opts);

            foreach (IBackend backend in backends)
            {
                int index = lstBackends.Items.Add(backend.Name);
                lstBackends.SetItemChecked(index, !opts.IsBackendDisabled(backend.Name));
            }

            // #mivance refactor
            IBackend amdBackend = backends.Find(backend => backend.Name == "AMDDXX");

            if (amdBackend is AMDDriverBackend)
            {
                AMDDriverBackend driver = amdBackend as AMDDriverBackend;

                foreach (string asic in driver.Asics)
                {
                    int index = lstAMDAsics.Items.Add(asic);
                    lstAMDAsics.SetItemChecked(index, !opts.IsAMDAsicDisabled(asic));
                }
            }

            IBackend codeXLBackend = backends.Find(backend => backend.Name == "CodeXL");

            if (codeXLBackend is CodeXLBackend)
            {
                CodeXLBackend driver = codeXLBackend as CodeXLBackend;
                foreach (string asic in driver.Asics)
                {
                    int index = lstCodeXLAsics.Items.Add(asic);
                    lstCodeXLAsics.SetItemChecked(index, !opts.IsCodeXLAsicDisabled(asic));
                }
            }
        }
예제 #57
0
        public void SetSource(ITreeDataSource source, IBackend sourceBackend)
        {
            this.source = source;
            RowHeights.Clear();
            tsource         = new TreeSource(source);
            Tree.DataSource = tsource;

            source.NodeInserted += (sender, e) => {
                var parent = tsource.GetItem(source.GetParent(e.Node));
                Tree.ReloadItem(parent, parent == null || Tree.IsItemExpanded(parent));
            };
            source.NodeDeleted += (sender, e) => {
                var parent = tsource.GetItem(e.Node);
                var item   = tsource.GetItem(e.Child);
                if (item != null)
                {
                    RowHeights.Remove(null);
                }
                Tree.ReloadItem(parent, parent == null || Tree.IsItemExpanded(parent));
            };
            source.NodeChanged += (sender, e) => {
                var item = tsource.GetItem(e.Node);
                if (item != null)
                {
                    Tree.ReloadItem(item, false);
                    UpdateRowHeight(item);
                }
            };
            source.NodesReordered += (sender, e) => {
                var parent = tsource.GetItem(e.Node);
                Tree.ReloadItem(parent, parent == null || Tree.IsItemExpanded(parent));
            };
            source.Cleared += (sender, e) =>
            {
                Tree.ReloadData();
                RowHeights.Clear();
            };
        }
        public IEnumerable <IBackend> GetConfiguredBackends(ISystemMetricsService systemMetrics)
        {
            if (_log.IsInfoEnabled)
            {
                var availableBackendsString = String.Join(", ", AvailableBackends.Select(x => x.Name));
                _log.InfoFormat("Available Backends: {0}", availableBackendsString);
            }

            foreach (var pair in BackendConfigurations)
            {
                string   backendName = pair.Key;
                IBackend backend     = AvailableBackends.FirstOrDefault(x => x.Name.Equals(backendName, StringComparison.OrdinalIgnoreCase));

                if (backend == null)
                {
                    _log.WarnFormat("Unrecognized backend configuration for \"{0}\".  Backend will be ignored.", backendName);
                    continue;
                }

                backend.Configure(Name, pair.Value, systemMetrics);
                yield return(backend);
            }
        }
예제 #59
0
        public MainWindow(IBackend gallifreyBackend)
        {
            InitializeComponent();

            gallifrey = gallifreyBackend;

            ExceptionlessClient.Default.Configuration.ApiKey  = "e7ac6366507547639ce69fea261d6545";
            ExceptionlessClient.Default.Configuration.Enabled = true;
            ExceptionlessClient.Default.Configuration.DefaultTags.Add(gallifrey.VersionControl.VersionName.Replace("\n", " - "));
            ExceptionlessClient.Default.SubmittingEvent += OnSubmittingExceptionlessEvent;
            ExceptionlessClient.Default.Register();

            internalTimerList = new Dictionary <DateTime, ThreadedBindingList <JiraTimer> >();

            try
            {
                gallifrey.Initialise();
            }
            catch (MissingJiraConfigException)
            {
                ShowSettings(false);
            }
            catch (JiraConnectionException)
            {
                ShowSettings(false);
            }
            catch (MultipleGallifreyRunningException)
            {
                MessageBox.Show("You Can Only Have One Instance Of Gallifrey Running At A Time\nPlease Close The Other Instance", "Multiple Instances", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                CloseNotifyIcon();
                exitOnStart = true;
            }

            gallifrey.NoActivityEvent   += GallifreyOnNoActivityEvent;
            gallifrey.ExportPromptEvent += GallifreyOnExportPromptEvent;
            SystemEvents.SessionSwitch  += SessionSwitchHandler;
        }
예제 #60
0
 internal ScrollAdjustment(IBackend backend)
 {
     BackendHost.SetCustomBackend(backend);
 }