string.IsNullOrEmpty(string)

Here are the examples of the csharp api class string.IsNullOrEmpty(string) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

200 Examples 7

51. Example

Project: boxcli
Source File: BoxDefaultSettings.cs
private BoxHomeDefaultSettings SetBoxDownloadsFolderPathIfNull(BoxHomeDefaultSettings settings)
        {
            if (string.IsNullOrEmpty(settings.BoxDownloadsFolderPath))
            {
                var path = $"{_boxHome.GetBaseDirectoryPath()}{Path.DirectorySeparatorChar}Downloads{Path.DirectorySeparatorChar}{settings.BoxDownloadsFolderName}";
                settings.BoxDownloadsFolderPath = path;
            }
            return settings;
        }

52. Example

Project: boxcli
Source File: FileSubCommandBase.cs
protected async Task<BoxFile> MoveFile(string fileId, string parentId, string etag = "")
        {
            var boxClient = base.ConfigureBoxClient(this._asUser.Value());
            var fileRequest = this.ConfigureFileRequest(fileId, parentId);
            if (!string.IsNullOrEmpty(etag))
            {
                return await boxClient.FilesManager.UpdateInformationAsync(fileRequest, etag);
            }
            else
            {
                return await boxClient.FilesManager.UpdateInformationAsync(fileRequest);
            }
        }

53. Example

Project: boxcli
Source File: FileVersionSubCommandBase.cs
protected void CheckForFileVersionId(string id, CommandLineApplication app)
        {
            if (string.IsNullOrEmpty(id))
            {
                app.ShowHelp();
                throw new Exception("A file version ID is required for this command.");
            }
        }

54. Example

Project: 0install-win
Source File: MainForm.cs
public IProgress<TaskSnapshot> GetProgressControl([NotNull] string taskName)
        {
            #region Sanity checks
            if (string.IsNullOrEmpty(taskName)) throw new ArgumentNullException(nameof(taskName));
            #endregion

            taskControl.TaskName = taskName;
            taskControl.Visible = true;
            return taskControl;
        }

55. Example

Project: 0install-win
Source File: MainForm.cs
public void ShowNotificactionBar([NotNull] string message, [NotNull] Action clickHandler)
        {
            #region Sanity checks
            if (string.IsNullOrEmpty(message)) throw new ArgumentNullException(nameof(message));
            if (clickHandler == null) throw new ArgumentNullException(nameof(clickHandler));
            #endregion

            var targetLocation = labelNotificationBar.Location;
            labelNotificationBar.Location -= new Size(0, labelNotificationBar.Height);
            labelNotificationBar.Text = message;
            labelNotificationBar.Visible = true;
            var timer = new Timer {Interval = 10, Enabled = true};
            components.Add(timer);
            timer.Tick += delegate
            {
                labelNotificationBar.Location += new Size(0, 1);
                if (labelNotificationBar.Location == targetLocation) timer.Enabled = false;
            };

            _notificationBarClickHandler = clickHandler;
        }

56. Example

Project: 0install-win
Source File: PortableCreatorDialog.cs
private void textBoxTarget_TextChanged(object sender, System.EventArgs e)
        {
            buttonDeploy.Enabled = !string.IsNullOrEmpty(textBoxTarget.Text);
        }

57. Example

Project: 0install-win
Source File: SyncWizard.cs
private void textBoxCredentials_TextChanged(object sender, EventArgs e)
        {
            pageCredentials.AllowNext = !string.IsNullOrEmpty(textBoxUsername.Text) && !string.IsNullOrEmpty(textBoxPassword.Text);
        }

58. Example

Project: 0install-win
Source File: SyncWizard.cs
private void textBoxCryptoKey_TextChanged(object sender, EventArgs e)
        {
            pageExistingCryptoKey.AllowNext = !string.IsNullOrEmpty(textBoxCryptoKey.Text);
        }

59. Example

Project: 0install-win
Source File: SyncWizard.cs
private void textBoxCryptoKeyReset_TextChanged(object sender, EventArgs e)
        {
            pageResetCryptoKey.AllowNext = !string.IsNullOrEmpty(textBoxCryptoKeyReset.Text);
        }

60. Example

Project: 0install-win
Source File: SyncWizard.cs
private void textBoxCryptoKeyNew_TextChanged(object sender, EventArgs e)
        {
            pageNewCryptoKey.AllowNext = !string.IsNullOrEmpty(textBoxCryptoKeyNew.Text);
        }

61. Example

Project: 0install-win
Source File: SyncWizard.cs
private void textBoxCryptoKeyChange_TextChanged(object sender, EventArgs e)
        {
            pageChangeCryptoKey.AllowNext = !string.IsNullOrEmpty(textBoxCryptoKeyChange.Text);
        }

62. Example

Project: 0install-win
Source File: AddAlias.cs
[ContractAnnotation("=>null,foundAppEntry:null; =>notnull,foundAppEntry:notnull")]
        internal static AppAlias GetAppAlias([NotNull] AppList appList, [NotNull] string aliasName, out AppEntry foundAppEntry)
        {
            #region Sanity checks
            if (appList == null) throw new ArgumentNullException(nameof(appList));
            if (string.IsNullOrEmpty(aliasName)) throw new ArgumentNullException(nameof(aliasName));
            #endregion

            var results =
                from entry in appList.Entries
                where entry.AccessPoints != null
                from alias in entry.AccessPoints.Entries.OfType<AppAlias>()
                where alias.Name == aliasName
                select new {entry, alias};

            var result = results.FirstOrDefault();
            if (result == null)
            {
                foundAppEntry = null;
                return null;
            }
            else
            {
                foundAppEntry = result.entry;
                return result.alias;
            }
        }

63. Example

Project: 0install-win
Source File: CommandBase.cs
[CanBeNull]
        protected Feed FindByShortName([NotNull] string shortName)
        {
            #region Sanity checks
            if (string.IsNullOrEmpty(shortName)) throw new ArgumentNullException(nameof(shortName));
            #endregion

            Feed result = null;
            if (!FeedManager.Refresh) result = CatalogManager.GetCachedSafe().FindByShortName(shortName);
            if (result == null && Config.NetworkUse != NetworkLevel.Offline) result = CatalogManager.GetOnlineSafe().FindByShortName(shortName);
            return result;
        }

64. Example

Project: 0install-win
Source File: ConfigDialog.cs
private void textBoxSyncServer_TextChanged(object sender, EventArgs e)
        {
            _config.SyncServer = (!textBoxSyncServer.IsValid || string.IsNullOrEmpty(textBoxSyncServer.Text)) ? new Uri(Config.DefaultSyncServer) : textBoxSyncServer.Uri;
            propertyGridAdvanced.Refresh();
        }

65. Example

Project: 0install-win
Source File: ProgressForm.cs
public IProgress<TaskSnapshot> GetProgressControl([NotNull] string taskName)
        {
            #region Sanity checks
            if (string.IsNullOrEmpty(taskName)) throw new ArgumentNullException(nameof(taskName));
            if (InvokeRequired) throw new InvalidOperationException("Method called from a non UI thread.");
            #endregion

            taskControl.Visible = true;

            // Hide other stuff
            if (_selectionsShown) selectionsControl.Hide();

            taskControl.TaskName = taskName;
            return taskControl;
        }

66. Example

Project: 0install-win
Source File: ProgressForm.cs
public void ShowTrayIcon(string information = null, ToolTipIcon messageType = ToolTipIcon.None)
        {
            #region Sanity checks
            if (InvokeRequired) throw new InvalidOperationException("Method called from a non UI thread.");
            #endregion

            notifyIcon.Visible = true;
            if (!string.IsNullOrEmpty(information)) notifyIcon.ShowBalloonTip(7500, "Zero Install", information, messageType);
        }

67. Example

Project: 0install-win
Source File: EntryPoint.Callbacks.cs
private void ConfigureTaskbar(IntPtr windowHandle)
        {
            if (_relaunchInformation == null || !WindowsUtils.IsWindows7) return;

            // Add correct relaunch information
            string commandPath = (_relaunchInformation.NeedsTerminal ? _relaunchControl.CommandPathCli : _relaunchControl.CommandPathGui + " --no-wait"); // Select best suited launcher
            string icon = (string.IsNullOrEmpty(_relaunchInformation.IconPath) ? null : _relaunchInformation.IconPath + ",0"); // Always use the first icon in the file
            WindowsTaskbar.SetWindowAppID(windowHandle,
                _relaunchInformation.AppID, '"' + commandPath + "\" run " + _relaunchInformation.Target, icon, _relaunchInformation.Name);

            // Add jump list entry to select an alternative application version
            WindowsTaskbar.AddTaskLinks(_relaunchInformation.AppID, new[] {new WindowsTaskbar.ShellLink("Versions", _relaunchControl.CommandPathGui, "run --customize " + _relaunchInformation.Target)});
        }

68. Example

Project: alphaTab
Source File: GpxParser.cs
private void ParseScoreNode(XmlNode element)
        {
            foreach (var c in element.ChildNo/n ..... /n //View Source file for more details /n }

69. Example

Project: alphaTab
Source File: GpxParser.cs
private void BuildModel()
        {
            // build score
            for (int i = 0, j = _mast/n ..... /n //View Source file for more details /n }

70. Example

Project: alphaTab
Source File: MusicXmlImporter.cs
private void ParseLyric(XmlNode element, Beat beat)
        {
            foreach (var c in element.ChildNodes)
            {
                if (c.NodeType == XmlNodeType.Element)
                {
                    switch (c.LocalName)
                    {
                        case "text":
                            if (!string.IsNullOrEmpty(beat.Text))
                            {
                                beat.Text += " " + c.InnerText;
                            }
                            else
                            {
                                beat.Text = c.InnerText;
                            }
                            break;
                    }
                }
            }
        }

71. Example

Project: alphaTab
Source File: MusicXmlImporter.cs
private void ParseIdentification(XmlNode element)
        {
            foreach (var c in element.ChildNodes)
            {
                if (c.NodeType == XmlNodeType.Element)
                {
                    switch (c.LocalName)
                    {
                        case "creator":
                            if (c.GetAttribute("type") == "composer")
                            {
                                _score.Words = c.InnerText;
                            }
                            break;
                        case "rights":
                            if (!string.IsNullOrEmpty(_score.Copyright))
                            {
                                _score.Copyright += "\n";
                            }
                            _score.Copyright += c.InnerText;
                            break;
                    }
                }
            }
        }

72. Example

Project: alphaTab
Source File: SvgCanvas.cs
public float MeasureText(string text)
        {
            if (string.IsNullOrEmpty(text)) return 0;
            var font = SupportedFonts.Arial;
            if (Font.Family.Contains("Times"))
            {
                font = SupportedFonts.TimesNewRoman;
            }
            return FontSizes.MeasureString(text, font, Font.Size, Font.Style);
        }

73. Example

Project: alphaTab
Source File: NoteNumberGlyph.cs
public override void DoLayout()
        {
            IsEmpty = string.IsNullOrEmpty(_noteString) && string.IsNullOrEmpty(_trillNoteString);
            if (!IsEmpty)
            {
                Renderer.ScoreRenderer.Canvas.Font = Renderer.Resources.TablatureFont;
                _noteStringWidth = Renderer.ScoreRenderer.Canvas.MeasureText(_noteString);
                _trillNoteStringWidth = Renderer.ScoreRenderer.Canvas.MeasureText(_trillNoteString);
                Width = _noteStringWidth + _trillNoteStringWidth;
            }
        }

74. Example

Project: alphaTab
Source File: ScoreLayout.cs
private void CreateScoreInfoGlyphs()
        {
            Logger.Info("ScoreLayout", "Creating scor/n ..... /n //View Source file for more details /n }

75. Example

Project: VRpportunity
Source File: OVRDebugInfo.cs
void UpdateStrings()
    {
        if (debugUIObject == null)
            return;       
                
        if (!string.IsNullOrEmpty(strFPS))
            fps.GetComponentInChildren<Text>().text = strFPS;
        if (!string.IsNullOrEmpty(strIPD))
            ipd.GetComponentInChildren<Text>().text = strIPD;
        if (!string.IsNullOrEmpty(strFOV))
            fov.GetComponentInChildren<Text>().text = strFOV;
        if (!string.IsNullOrEmpty(strResolutionEyeTexture))
            resolutionEyeTexture.GetComponentInChildren<Text>().text = strResolutionEyeTexture;
        if (!string.IsNullOrEmpty(strLatencies))
		{
            latencies.GetComponentInChildren<Text>().text = strLatencies;
			latencies.GetComponentInChildren<Text>().fontSize = 14;
		}
        if (!string.IsNullOrEmpty(strHeight))
            height.GetComponentInChildren<Text>().text = strHeight;
		if (!string.IsNullOrEmpty(strDepth))
			depth.GetComponentInChildren<Text>().text = strDepth;
	}

76. Example

Project: TraceLab
Source File: TrueIfSelectedDesignModeValueProvider.cs
private static bool IsIdentifierEmpty(PropertyIdentifier identifier)
        {
#if SILVERLIGHT
            return identifier.IsEmpty;
#else
            return String.IsNullOrEmpty(identifier.Name);
#endif
        }

77. Example

Project: TraceLab
Source File: DataGridBoundColumn.cs
private static object OnCoerceSortMemberPath(DependencyObject d, object baseValue)
        {
            var column = (DataGridBoundColumn)d;
            var sortMemberPath = (string)baseValue;

            if (string.IsNullOrEmpty(sortMemberPath))
            {
                sortMemberPath = DataGridHelper.GetPathFromBinding(column.Binding as Binding);
            }

            return sortMemberPath;
        }

78. Example

Project: TraceLab
Source File: DataGridComboBoxColumn.cs
private static object OnCoerceSortMemberPath(DependencyObject d, object baseValue)
        {
            var column = (DataGridComboBoxColumn)d;
            var sortMemberPath = (string)baseValue;

            if (string.IsNullOrEmpty(sortMemberPath))
            {
                sortMemberPath = DataGridHelper.GetPathFromBinding(column.EffectiveBinding as Binding);
            }

            return sortMemberPath;
        }

79. Example

Project: TraceLab
Source File: DataGridHelper.cs
internal static string GetPathFromBinding(Binding binding)
        {
            if (binding != null)
            {
                if (!string.IsNullOrEmpty(binding.XPath))
                {
                    return binding.XPath;
                }
                else if (binding.Path != null)
                {
                    return binding.Path.Path;
                }
            }

            return null;
        }

80. Example

Project: TraceLab
Source File: DataGridTemplateColumn.cs
private static object OnCoerceTemplateColumnCanUserSort(DependencyObject d, object baseValue)
        {
            DataGridTemplateColumn templateColumn = (DataGridTemplateColumn)d;
            if (string.IsNullOrEmpty(templateColumn.SortMemberPath))
            {
                return false;
            }

            return DataGridColumn.OnCoerceCanUserSort(d, baseValue);
        }

81. Example

Project: TraceLab
Source File: ExperimentTest.cs
[TestMethod]
        public void ExperimentNew()
        {
            IExperiment experiment = ExperimentManager.New();
            Assert.IsNotNull(experiment);
            Assert.IsFalse(experiment.IsModified);
            Assert.AreEqual(2, experiment.VertexCount);
            Assert.IsTrue(string.IsNullOrEmpty(experiment.ExperimentInfo.FilePath));
        }

82. Example

Project: TraceLab
Source File: AboutExperimentDialog.cs
private bool hasChallengePasswordBeenUsed(){
            if (!string.IsNullOrEmpty (m_applicationViewModel.Experiment.ExperimentInfo.ChallengePassword) &&
                m_applicationViewModel.Experiment.ExperimentInfo.ChallengePassword.Equals(m_applicationViewModel.Experiment.unlockingPassword)){
                return true;
            }
            return false;        
        }

83. Example

Project: TraceLab
Source File: TabStrip.cs
public void SetLabel (Gtk.Widget page, Gdk.Pixbuf icon, string label)
		{
			Pango.EllipsizeMode oldMode = Pango.EllipsizeMode.End;
			
			this.page = page;
			if (Child != null) {
				if (labelWidget != null)
					oldMode = labelWidget.Ellipsize;
				Gtk.Widget oc = Child;
				Remove (oc);
				oc.Destroy ();
			}
			
			Gtk.HBox box = new HBox ();
			box.Spacing = 2;
			
			if (icon != null)
				box.PackStart (new Gtk.Image (icon), false, false, 0);

			if (!string.IsNullOrEmpty (label)) {
				labelWidget = new Gtk.Label (label);
				labelWidget.UseMarkup = true;
				box.PackStart (labelWidget, true, true, 0);
			} else {
				labelWidget = null;
			}
			
			Add (box);
			
			// Get the required size before setting the ellipsize property, since ellipsized labels
			// have a width request of 0
			ShowAll ();
			labelWidth = SizeRequest ().Width;
			
			if (labelWidget != null)
				labelWidget.Ellipsize = oldMode;
		}

84. Example

Project: TraceLab
Source File: PasswordPicker.cs
protected void OnButtonOkClicked (object sender, EventArgs e)
        {
            this.error = "";/n ..... /n //View Source file for more details /n }

85. Example

Project: TraceLab
Source File: AuthenticationAndUploadViewModel.cs
private bool CanExecuteAuthenticate(object param)
        {
            if (String.IsNullOrEmpty(Username) || String.IsNullOrEmpty(Password))
            {
                return false;
            }

            return true;
        }

86. Example

Project: TraceLab
Source File: BenchmarkWizardViewModel.cs
private bool CanAdvanceState(object param)
        {
            //if state is process allow advancing only when experiment is completed and if contest is online
            if (CurrentState == BenchmarkWizardState.Process)
                return BenchmarkExperimentCompleted && SelectedBenchmark.IsOnlineContest;

            if (CurrentState == BenchmarkWizardState.QuestionToPublishResults)
                return !String.IsNullOrEmpty(TechniqueName) && !String.IsNullOrEmpty(TechniqueDescription);

            if (CurrentState == BenchmarkWizardState.AuthenticationAndUpload)
                return false; //cannot advance anymore so disable button

            return SelectedBenchmark != null && SelectedBenchmark.ComponentTemplate != null && CurrentState != BenchmarkWizardState.Process;
        }

87. Example

Project: TraceLab
Source File: DefiningBenchmarkViewModel.cs
private bool CanExecuteDefine(object param)
        {
            bool canExecuteDefine = (String.IsNullOrEmpty(BenchmarkInfo.FilePath) == false && SelectedTemplateNode != null);
            //if contest is to be published, it is required to select also experiment results
            if (PublishContest == true)
            {
                canExecuteDefine = canExecuteDefine && SelectedExperimentResults != null;
            }

            return canExecuteDefine;
        }

88. Example

Project: TraceLab
Source File: TraceLabApplication.cs
private static void SetExperimentFileToBeOpen(string value)
        {
         if (string.IsNullOrEmpty(value))
                throw new ArgumentNullException("value");

            ExperimentFileToBeOpen = value;
           
        }

89. Example

Project: TraceLab
Source File: TraceLabApplication.cs
private static void SetDecisionsDirectory(string value)
        {
            if (string.IsNullOrEmpty(value))
                throw new ArgumentNullException("value");

            DecisionDirectory = value;
        }

90. Example

Project: TraceLab
Source File: TraceLabApplication.cs
private static void SetWorkspaceDirectory(string value)
        {
            if (string.IsNullOrEmpty(value))
                throw new ArgumentNullException("value");

            WorkspaceDirectory = value;
        }

91. Example

Project: TraceLab
Source File: TraceLabApplication.cs
private static void SetCacheDirectory(string value)
        {
            if (string.IsNullOrEmpty(value))
                throw new ArgumentNullException("value");

            CacheDirectory = value;
        }

92. Example

Project: TraceLab
Source File: TraceLabApplication.cs
private static void SetBaseDirectory(string value)
        {
            if (string.IsNullOrEmpty(value))
                throw new ArgumentNullException("value");

            BaseDirectory = value;
        }

93. Example

Project: cofoundry
Source File: SmtpMailDispatchService.cs
private string GetDebugDropPath()
        {
            if (string.IsNullOrEmpty(_smtpMailSettings.DebugMailDropDirectory))
            {
                throw new ApplicationException("Cofoundry:SmtpMail:DebugMailDropDirectory configuration has been requested and is not set.");
            }

            var debugMailDropDirectory = _pathResolver.MapPath(_smtpMailSettings.DebugMailDropDirectory);
            if (!Directory.Exists(debugMailDropDirectory))
            {
                Directory.CreateDirectory(debugMailDropDirectory);
            }

            return debugMailDropDirectory;
        }

94. Example

Project: cofoundry
Source File: QueryExecutorExtensions.cs
public static TEntity GetById<TEntity>(this IQueryExecutor executor, string id)
        {
            if (string.IsNullOrEmpty(id)) return default(TEntity);
            var query = new GetByStringQuery<TEntity>() { Id = id };
            return executor.Execute(query);
        }

95. Example

Project: cofoundry
Source File: QueryExecutorExtensions.cs
public static TEntity GetById<TEntity>(this IQueryExecutor executor, string id, IExecutionContext ex)
        {
            if (string.IsNullOrEmpty(id)) return default(TEntity);
            var query = new GetByStringQuery<TEntity>() { Id = id };
            return executor.Execute(query, ex);
        }

96. Example

Project: cofoundry
Source File: QueryExecutorExtensions.cs
public static async Task<TEntity> GetByIdAsync<TEntity>(this IQueryExecutor executor, string id)
        {
            if (string.IsNullOrEmpty(id)) return default(TEntity);
            var query = new GetByStringQuery<TEntity>() { Id = id };
            return await executor.ExecuteAsync(query);
        }

97. Example

Project: cofoundry
Source File: QueryExecutorExtensions.cs
public static async Task<TEntity> GetByIdAsync<TEntity>(this IQueryExecutor executor, string id, IExecutionContext ex)
        {
            if (string.IsNullOrEmpty(id)) return default(TEntity);
            var query = new GetByStringQuery<TEntity>() { Id = id };
            return await executor.ExecuteAsync(query, ex);
        }

98. Example

Project: cofoundry
Source File: SearchImageAssetSummariesQueryHandler.cs
public async Task<PagedQueryResult<ImageAssetSummary>> ExecuteAsync(SearchImageAssetSumm/n ..... /n //View Source file for more details /n }

99. Example

Project: cofoundry
Source File: SearchPageSummariesQueryHandler.cs
private IQueryable<PageSummary> CreateQuery(SearchPageSummariesQuery query)
        {
        /n ..... /n //View Source file for more details /n }

100. Example

Project: cofoundry
Source File: RegisterPageTemplatesCommandHandler.cs
private Task EnsureCustomEntityDefinitionExists(
            PageTemplateFileInfo fileTemplateDetails,
            PageTemplate dbPageTemplate
            )
        {
            var definitionCode = fileTemplateDetails.CustomEntityDefinition?.CustomEntityDefinitionCode;

            // Only update/check the definition if it has changed to potentially save a query
            if (!string.IsNullOrEmpty(definitionCode) && (dbPageTemplate == null || definitionCode != dbPageTemplate.CustomEntityDefinitionCode))
            {
                var command = new EnsureCustomEntityDefinitionExistsCommand(fileTemplateDetails.CustomEntityDefinition.CustomEntityDefinitionCode);
                return _commandExecutor.ExecuteAsync(command);
            }

            return Task.CompletedTask;
        }