System.Action.Invoke(bool)

Here are the examples of the csharp api System.Action.Invoke(bool) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

783 Examples 7

19 Source : FindReplaceViewModel.cs
with MIT License
from AngryCarrot789

public void Cancel()
        {
            Position = 0;
            ClearItems();
            FindWhatText = "";

            SetFindViewIsVisibleCallback?.Invoke(false);
            IsVisibileAndFocused = false;
        }

19 Source : FindReplaceViewModel.cs
with MIT License
from AngryCarrot789

public void HighlightResultAtIndex(int position)
        {
            int index = position - 1;
            if (Count > 0 && index >= 0 && index < Count)
            {
                FindResult result = FoundItems[index];
                HighlightResultCallback?.Invoke(result, true);
                SetFindViewIsVisibleCallback?.Invoke(true);
                IsVisibileAndFocused = true;
            }
        }

19 Source : SongListUtils.cs
with GNU Lesser General Public License v3.0
from angturil

public static IEnumerator ScrollToLevel(string levelID, Action<bool> callback, bool animated, bool isRetry = false)
        {
            if (_levelCollectionViewController)
            {
                Plugin.Log($"Scrolling to {levelID}! Retry={isRetry}");

                // handle if song browser is present
                if (Plugin.SongBrowserPluginPresent)
                {
                    Plugin.SongBrowserCancelFilter();
                }

                // Make sure our custom songpack is selected
                yield return SelectCustomSongPack();

                int songIndex = 0;

                // get the table view
                var levelsTableView = _levelCollectionViewController.GetField<LevelCollectionTableView, LevelCollectionViewController>("_levelCollectionTableView");

                //RequestBot.Instance.QueueChatMessage($"selecting song: {levelID} pack: {packIndex}");

                // get the table view
                var tableView = levelsTableView.GetField<TableView, LevelCollectionTableView>("_tableView");

                // get list of beatmaps, this is pre-sorted, etc
                var beatmaps = levelsTableView.GetField<IPreviewBeatmapLevel[], LevelCollectionTableView>("_previewBeatmapLevels").ToList();

                // get the row number for the song we want
                songIndex = beatmaps.FindIndex(x => (x.levelID.StartsWith("custom_level_" + levelID)));

                // bail if song is not found, shouldn't happen
                if (songIndex >= 0)
                {
                    // if header is being shown, increment row
                    if (levelsTableView.GetField<bool, LevelCollectionTableView>("_showLevelPackHeader"))
                    {
                        songIndex++;
                    }

                    Plugin.Log($"Selecting row {songIndex}");

                    // scroll to song
                    tableView.ScrollToCellWithIdx(songIndex, TableView.ScrollPositionType.Beginning, animated);

                    // select song, and fire the event
                    tableView.SelectCellWithIdx(songIndex, true);

                    Plugin.Log("Selected song with index " + songIndex);
                    callback?.Invoke(true);

                    if (RequestBotConfig.Instance.ClearNoFail)
                    {
                        try
                        {
                            // disable no fail gamepaly modifier
                            var gameplayModifiersPanelController = Resources.FindObjectsOfTypeAll<GameplayModifiersPanelController>().First();
                            var gamePlayModifierToggles = gameplayModifiersPanelController.GetField<GameplayModifierToggle[], GameplayModifiersPanelController>("_gameplayModifierToggles");
                            foreach (var gamePlayModifierToggle in gamePlayModifierToggles)
                            {
                                if (gamePlayModifierToggle.gameplayModifier.modifierNameLocalizationKey == "MODIFIER_NO_FAIL")
                                {
                                    gameplayModifiersPanelController.SetToggleValueWithGameplayModifierParams(gamePlayModifierToggle.gameplayModifier, false);
                                }
                            }
                            gameplayModifiersPanelController.RefreshTotalMultiplierAndRankUI();
                        }
                        catch
                        { }

                    }
                    yield break;
                }
            }

            if (!isRetry)
            {
                yield return ScrollToLevel(levelID, callback, animated, true);
                yield break;
            }

            Plugin.Log($"Failed to scroll to {levelID}!");
            callback?.Invoke(false);
        }

19 Source : SlideDownMenuPageRenderer.cs
with MIT License
from anjoy8

public override void ViewDidAppear(bool animated)
		{
			base.ViewDidAppear(animated);
			if (ViewDidAppearEvent != null)
				ViewDidAppearEvent(animated);

		}

19 Source : SlideDownMenuPageRenderer.cs
with MIT License
from anjoy8

public override void ViewDidDisappear(bool animated)
		{
			base.ViewDidDisappear(animated);
			if (ViewDidDisappearEvent != null)
				ViewDidDisappearEvent(animated);
		}

19 Source : MLPersistentPoint.cs
with MIT License
from aornelas

void SetComplete(bool success)
        {
            if (OnComplete != null)
            {
                OnComplete(success);
            }
        }

19 Source : OrderFieldOptionalCell.cs
with Apache License 2.0
from AppRopio

void SwitchChanged(object sender, EventArgs e)
        {
            _textViewLayout.Hidden = !_switch.On;

            if (OnSwitchChanged != null)
                OnSwitchChanged.Invoke(_switch.On);

            if (_textView.IsFirstResponder)
                _textView.EndEditing(true);
            else if (!_textViewLayout.Hidden)
                _textView.BecomeFirstResponder();
        }

19 Source : ArtworkEditor.cs
with MIT License
from Arefu

private void Chckbx_use_pendulum_CheckedChanged(object sender, EventArgs e)
        {
            UsePendulumCheckedChanged?.Invoke(chkbx_pendulum.Checked);
        }

19 Source : Async.cs
with MIT License
from ArnaudValensi

bool OnUpdate() {
			if (result) {
				cb(true);
				return false; // Stop coroutine
			}

			if (items.Count > 0) {
				nbFnCalled++;
				fn(items.PopFirst(), isDone => {
					result = isDone;
					nbFnCalled--;
				});
			} else if (nbFnCalled == 0) {
				cb(false);
				return false; // Stop coroutine
			}

			return true; // Continue coroutine
		}

19 Source : SimConnectAdapter.cs
with The Unlicense
from astenlund

public void Connect(IntPtr hwnd, uint atreplacedudeFrequency)
        {
            try
            {
                UnsubscribeEvents();

                _simConnect?.Dispose();
                _atreplacedudeTimer?.Dispose();

                _simConnect = new SimConnectImpl(AppName, hwnd, WM_USER_SIMCONNECT, null, 0);
                _atreplacedudeTimer = new Timer(RequestAtreplacedudeData, null, 100, 1000 / atreplacedudeFrequency);

                SubscribeEvents();

                StateChanged?.Invoke(false);
            }
            catch (COMException e)
            {
                Console.Error.WriteLine("Exception caught: " + e);
                StateChanged?.Invoke(true);
            }
        }

19 Source : SimConnectAdapter.cs
with The Unlicense
from astenlund

private void DisconnectInternal(bool failure)
        {
            UnsubscribeEvents();

            _atreplacedudeTimer?.Dispose();
            _atreplacedudeTimer = null;

            _simConnect?.Dispose();
            _simConnect = null;

            StateChanged?.Invoke(failure);
        }

19 Source : ResourceGuard.cs
with GNU General Public License v3.0
from audiamus

public void Dispose () {
      _onDispose?.Invoke ();
      _onNewAndDispose?.Invoke (false);
      _resource?.Release ();
    }

19 Source : RegionNavigationJournal.cs
with MIT License
from AvaloniaCommunity

private void InternalNavigate(IRegionNavigationJournalEntry entry, Action<bool> callback)
        {
            this.isNavigatingInternal = true;
            this.NavigationTarget.RequestNavigate(
                entry.Uri,
                nr =>
                {
                    this.isNavigatingInternal = false;

                    if (nr.Result.HasValue)
                    {
                        callback(nr.Result.Value);
                    }
                },
                entry.Parameters);
        }

19 Source : RegionNavigationServiceFixture.new.cs
with MIT License
from AvaloniaCommunity

[TestMethod]
        public void WhenViewAcceptsNavigationOutAfterNewIncomingRequestIsReceived_ThenOriginalRequestIsIgnored()
        {
            var region = new Region();

            var viewMock = new Mock<IConfirmNavigationRequest>();
            var view = viewMock.Object;

            var confirmationRequests = new List<Action<bool>>();

            viewMock
                .Setup(icnr => icnr.ConfirmNavigationRequest(It.IsAny<NavigationContext>(), It.IsAny<Action<bool>>()))
                .Callback<NavigationContext, Action<bool>>((nc, c) => { confirmationRequests.Add(c); });

            region.Add(view);
            region.Activate(view);

            var navigationUri = new Uri("", UriKind.Relative);

            var serviceLocatorMock = new Mock<IServiceLocator>();
            serviceLocatorMock
                .Setup(x => x.GetInstance<IRegionNavigationJournalEntry>())
                .Returns(new RegionNavigationJournalEntry());

            var contentLoaderMock = new Mock<IRegionNavigationContentLoader>();
            contentLoaderMock
                .Setup(cl => cl.LoadContent(region, It.IsAny<NavigationContext>()))
                .Returns(view);

            var serviceLocator = serviceLocatorMock.Object;
            var contentLoader = contentLoaderMock.Object;
            var journal = new Mock<IRegionNavigationJournal>().Object;

            var target = new RegionNavigationService(serviceLocator, contentLoader, journal);
            target.Region = region;

            bool firstNavigation = false;
            bool secondNavigation = false;
            target.RequestNavigate(navigationUri, nr => firstNavigation = nr.Result.Value);
            target.RequestNavigate(navigationUri, nr => secondNavigation = nr.Result.Value);

            replacedert.AreEqual(2, confirmationRequests.Count);

            confirmationRequests[0](true);
            confirmationRequests[1](true);

            replacedert.IsFalse(firstNavigation);
            replacedert.IsTrue(secondNavigation);
        }

19 Source : RegionNavigationServiceFixture.new.cs
with MIT License
from AvaloniaCommunity

[TestMethod]
        public void WhenViewModelAcceptsNavigationOutAfterNewIncomingRequestIsReceived_ThenOriginalRequestIsIgnored()
        {
            var region = new Region();

            var viewModelMock = new Mock<IConfirmNavigationRequest>();

            var viewMock = new Mock<FrameworkElement>();
            var view = viewMock.Object;
            view.DataContext = viewModelMock.Object;

            var confirmationRequests = new List<Action<bool>>();

            viewModelMock
                .Setup(icnr => icnr.ConfirmNavigationRequest(It.IsAny<NavigationContext>(), It.IsAny<Action<bool>>()))
                .Callback<NavigationContext, Action<bool>>((nc, c) => { confirmationRequests.Add(c); });

            region.Add(view);
            region.Activate(view);

            var navigationUri = new Uri("", UriKind.Relative);

            var serviceLocatorMock = new Mock<IServiceLocator>();
            serviceLocatorMock
                .Setup(x => x.GetInstance<IRegionNavigationJournalEntry>())
                .Returns(new RegionNavigationJournalEntry());

            var contentLoaderMock = new Mock<IRegionNavigationContentLoader>();
            contentLoaderMock
                .Setup(cl => cl.LoadContent(region, It.IsAny<NavigationContext>()))
                .Returns(view);

            var serviceLocator = serviceLocatorMock.Object;
            var contentLoader = contentLoaderMock.Object;
            var journal = new Mock<IRegionNavigationJournal>().Object;

            var target = new RegionNavigationService(serviceLocator, contentLoader, journal);
            target.Region = region;

            bool firstNavigation = false;
            bool secondNavigation = false;
            target.RequestNavigate(navigationUri, nr => firstNavigation = nr.Result.Value);
            target.RequestNavigate(navigationUri, nr => secondNavigation = nr.Result.Value);

            replacedert.AreEqual(2, confirmationRequests.Count);

            confirmationRequests[0](true);
            confirmationRequests[1](true);

            replacedert.IsFalse(firstNavigation);
            replacedert.IsTrue(secondNavigation);
        }

19 Source : RegionNavigationServiceFixture.new.cs
with MIT License
from AvaloniaCommunity

[TestMethod]
        public void WhenTargetViewCreationThrowsWithAsyncConfirmation_ThenExceptionIsProvidedToNavigationCallback()
        {
            var serviceLocatorMock = new Mock<IServiceLocator>();

            var targetException = new Exception();
            var targetHandlerMock = new Mock<IRegionNavigationContentLoader>();
            targetHandlerMock
                .Setup(th => th.LoadContent(It.IsAny<IRegion>(), It.IsAny<NavigationContext>()))
                .Throws(targetException);

            var journalMock = new Mock<IRegionNavigationJournal>();

            Action<bool> navigationCallback = null;
            var viewMock = new Mock<IConfirmNavigationRequest>();
            viewMock
                .Setup(v => v.ConfirmNavigationRequest(It.IsAny<NavigationContext>(), It.IsAny<Action<bool>>()))
                .Callback<NavigationContext, Action<bool>>((nc, c) => { navigationCallback = c; });

            var region = new Region();
            region.Add(viewMock.Object);
            region.Activate(viewMock.Object);

            var target = new RegionNavigationService(serviceLocatorMock.Object, targetHandlerMock.Object, journalMock.Object);
            target.Region = region;

            NavigationResult result = null;
            target.RequestNavigate(new Uri("", UriKind.Relative), nr => result = nr);
            navigationCallback(true);

            replacedert.IsNotNull(result);
            replacedert.AreSame(targetException, result.Error);
        }

19 Source : CheckableMenuItem.cs
with MIT License
from awaescher

private void CheckableMenuItem_Activated(object sender, EventArgs e)
		{
			State = (State == NSCellStateValue.On) ? NSCellStateValue.Off : NSCellStateValue.On;
			OnChange.Invoke(State == NSCellStateValue.On);
		}

19 Source : WindowMessageSink.cs
with MIT License
from ay2015

private void ProcessWindowMessage(uint msg, IntPtr wParam, IntPtr lParam)
        {
            if (msg != CallbackMessageId) return;

            switch (lParam.ToInt32())
            {
                case 0x200:
                    MouseEventReceived(MouseEvent.MouseMove);
                    break;

                case 0x201:
                    MouseEventReceived(MouseEvent.IconLeftMouseDown);
                    break;

                case 0x202:
                    if (!isDoubleClick)
                    {
                        MouseEventReceived(MouseEvent.IconLeftMouseUp);
                    }
                    isDoubleClick = false;
                    break;

                case 0x203:
                    isDoubleClick = true;
                    MouseEventReceived(MouseEvent.IconDoubleClick);
                    break;

                case 0x204:
                    MouseEventReceived(MouseEvent.IconRightMouseDown);
                    break;

                case 0x205:
                    MouseEventReceived(MouseEvent.IconRightMouseUp);
                    break;

                case 0x206:
                    //double click with right mouse button - do not trigger event
                    break;

                case 0x207:
                    MouseEventReceived(MouseEvent.IconMiddleMouseDown);
                    break;

                case 520:
                    MouseEventReceived(MouseEvent.IconMiddleMouseUp);
                    break;

                case 0x209:
                    //double click with middle mouse button - do not trigger event
                    break;

                case 0x402:
                    BalloonToolTipChanged(true);
                    break;

                case 0x403:
                case 0x404:
                    BalloonToolTipChanged(false);
                    break;

                case 0x405:
                    MouseEventReceived(MouseEvent.BalloonToolTipClicked);
                    break;

                case 0x406:
                    ChangeToolTipStateRequest(true);
                    break;

                case 0x407:
                    ChangeToolTipStateRequest(false);
                    break;

                default:
                    Debug.WriteLine("Unhandled NotifyIcon message ID: " + lParam);
                    break;
            }
        }

19 Source : pg_Editor.cs
with MIT License
from azsumas

void ToggleMenuVisibility()
		{
			menuOpen = !menuOpen;
			EditorPrefs.SetBool(pg_Constant.ProGridsIsExtended, menuOpen);

			extendoStyle.normal.background = menuOpen ? icon_extendoClose : icon_extendoOpen;
			extendoStyle.hover.background = menuOpen ? icon_extendoClose : icon_extendoOpen;

			foreach (System.Action<bool> listener in toolbarEventSubscribers)
				listener(menuOpen);

			RepaintSceneView();
		}

19 Source : pg_Editor.cs
with MIT License
from azsumas

public void Close(bool isBeingDestroyed)
		{
			pg_GridRenderer.Destroy();

			SceneView.onSceneGUIDelegate -= OnSceneGUI;
			EditorApplication.update -= Update;
			EditorApplication.hierarchyWindowChanged -= HierarchyWindowChanged;

			instance = null;

			foreach (System.Action<bool> listener in toolbarEventSubscribers)
				listener(false);

			pg_Util.SetUnityGridEnabled(true);

			SceneView.RepaintAll();
		}

19 Source : pg_Editor.cs
with MIT License
from azsumas

void SetMenuIsExtended(bool isExtended)
		{
			menuOpen = isExtended;
			menuIsOrtho = ortho;
			menuStart = menuOpen ? MENU_EXTENDED : MENU_HIDDEN;

			menuBackgroundColor.a = 0f;
			extendoNormalColor.a = menuBackgroundColor.a;
			extendoHoverColor.a = (menuBackgroundColor.a / .5f);

			extendoStyle.normal.background = menuOpen ? icon_extendoClose : icon_extendoOpen;
			extendoStyle.hover.background = menuOpen ? icon_extendoClose : icon_extendoOpen;

			foreach (System.Action<bool> listener in toolbarEventSubscribers)
				listener(menuOpen);

			EditorPrefs.SetBool(pg_Constant.ProGridsIsExtended, menuOpen);
		}

19 Source : UniDebugMenuScene.cs
with MIT License
from baba-s

private void OpenImpl<T>
		(
			DMType				type		,
			ListCreatorBase<T>	creator		,
			Action<bool>		onSetActive
		)
		{
			// 表示するコンテンツの複製元を取得します
			var original = GetContent( type );

			// 表示するコンテンツを複製して表示を設定します
			var obj = Instantiate( original, m_instantiateRoot );
			obj.DebugMenuScene = this;
			obj.gameObject.SetActive( true );
			obj.SetDisp( creator );

			// 現在表示されているコンテンツを非表示にします
			onSetActive?.Invoke( false );

			// 戻るボタンが押されたら追加したコンテンツを削除して
			// 最初に表示していたコンテンツを表示します
			obj.mOnBack = () =>
			{
				Destroy( obj.gameObject );
				onSetActive?.Invoke( true );
			};
		}

19 Source : WindowMessageSink.cs
with Apache License 2.0
from beckzhu

private void ProcessWindowMessage(uint msg, IntPtr wParam, IntPtr lParam)
        {
            if (msg != CallbackMessageId) return;

            switch (lParam.ToInt32())
            {
                case 0x200:
                    MouseEventReceived(MouseEvent.MouseMove);
                    break;

                case 0x201:
                    MouseEventReceived(MouseEvent.IconLeftMouseDown);
                    break;

                case 0x202:
                    if (!isDoubleClick)
                    {
                        MouseEventReceived(MouseEvent.IconLeftMouseUp);
                    }
                    isDoubleClick = false;
                    break;

                case 0x203:
                    isDoubleClick = true;
                    MouseEventReceived(MouseEvent.IconDoubleClick);
                    break;

                case 0x204:
                    MouseEventReceived(MouseEvent.IconRightMouseDown);
                    break;

                case 0x205:
                    MouseEventReceived(MouseEvent.IconRightMouseUp);
                    break;

                case 0x206:
                    //double click with right mouse button - do not trigger event
                    break;

                case 0x207:
                    MouseEventReceived(MouseEvent.IconMiddleMouseDown);
                    break;

                case 520:
                    MouseEventReceived(MouseEvent.IconMiddleMouseUp);
                    break;

                case 0x209:
                    //double click with middle mouse button - do not trigger event
                    break;

                case 0x402:
                    var listener = BalloonToolTipChanged;
                    if (listener != null) listener(true);
                    break;

                case 0x403:
                case 0x404:
                    listener = BalloonToolTipChanged;
                    if (listener != null) listener(false);
                    break;

                case 0x405:
                    MouseEventReceived(MouseEvent.BalloonToolTipClicked);
                    break;

                case 0x406:
                    listener = ChangeToolTipStateRequest;
                    if (listener != null) listener(true);
                    break;

                case 0x407:
                    listener = ChangeToolTipStateRequest;
                    if (listener != null) listener(false);
                    break;

                default:
                    Debug.WriteLine("Unhandled NotifyIcon message ID: " + lParam);
                    break;
            }
        }

19 Source : DialogService.cs
with MIT License
from Binwell

void DialogQuestionCallback(MessageBus bus, DialogQuestionInfo questionInfo) {
			if (questionInfo == null) throw new ArgumentNullException(nameof(questionInfo));

			if (_app?.MainPage == null)
				throw new FieldAccessException(@"App property not set or App Main Page is not set. Use Init() before using dialogs");

			Device.BeginInvokeOnMainThread(async () => {
				                               var result = await _app.MainPage.DisplayAlert(questionInfo.replacedle, questionInfo.Question,
				                                                                             questionInfo.Positive, questionInfo.Negative);
				                               questionInfo.OnCompleted?.Invoke(result);
			                               });
		}

19 Source : TempoProperties.cs
with MIT License
from BleuBleu

private void ShowConvertTempoDialogAsync(bool conversionNeeded, Action<bool> callback)
        {
            if (conversionNeeded)
            {
                const string label = "You changed the BPM enough so that the number of frames in a note has changed. What do you want to do?";

                var messageDlg = new PropertyDialog("Tempo Conversion", 400, true, false);
                messageDlg.Properties.AddLabel(null, label, true); // 0
                messageDlg.Properties.AddRadioButton(PlatformUtils.IsMobile ? label : null, "Resize notes to reflect the new BPM. This is the most sensible option if you just want to change the tempo of the song.", true); // 1
                messageDlg.Properties.AddRadioButton(PlatformUtils.IsMobile ? label : null, "Leave the notes exactly where they are, just move the grid lines around the notes. This option is useful if you want to change how the notes are grouped.", false); // 2
                messageDlg.Properties.SetPropertyVisible(0, PlatformUtils.IsDesktop);
                messageDlg.Properties.Build();
                messageDlg.ShowDialogAsync(null, (r) =>
                {
                    callback(messageDlg.Properties.GetPropertyValue<bool>(1));
                });
            }
            else
            {
                callback(false);
            }
        }

19 Source : TempoProperties.cs
with MIT License
from BleuBleu

private void ShowConvertTempoDialogAsync(bool conversionNeeded, Action<bool> callback)
        {
            if (conversionNeeded)
            {
                const string label = "You changed the BPM enough so that the number of frames in a note has changed. What do you want to do?";

                var messageDlg = new PropertyDialog("Tempo Conversion", 400, true, false);
                messageDlg.Properties.AddLabel(null, label, true); // 0
                messageDlg.Properties.AddRadioButton(PlatformUtils.IsMobile ? label : null, "Resize notes to reflect the new BPM. This is the most sensible option if you just want to change the tempo of the song.", true); // 1
                messageDlg.Properties.AddRadioButton(PlatformUtils.IsMobile ? label : null, "Leave the notes exactly where they are, just move the grid lines around the notes. This option is useful if you want to change how the notes are grouped.", false); // 2
                messageDlg.Properties.SetPropertyVisible(0, PlatformUtils.IsDesktop);
                messageDlg.Properties.Build();
                messageDlg.ShowDialogAsync(null, (r) =>
                {
                    callback(messageDlg.Properties.GetPropertyValue<bool>(1));
                });
            }
            else
            {
                callback(false);
            }
        }

19 Source : PackageViewController.cs
with MIT License
from bonsai-rx

private void AddPackageRange(IList<IPackageSearchMetadata> packages)
        {
            if (packages.Count > 0)
            {
                if (packages.Count > 1 && packagePageSelector.SelectedPage == 0 &&
                    packageView.OperationText == Resources.UpdateOperationName)
                {
                    setMultiOperationVisible(true);
                }

                packageView.BeginUpdate();
                packageView.Nodes.Clear();
                packageIcons.Images.Clear();
                foreach (var package in packages)
                {
                    AddPackage(package);
                }
                packageView.EndUpdate();
                packageView.CanSelectNodes = true;
            }
        }

19 Source : PackageViewController.cs
with MIT License
from bonsai-rx

public void SetPackageViewStatus(string text, Image image = null)
        {
            if (packageView.Nodes.ContainsKey(text)) return;
            setMultiOperationVisible(false);
            packageView.CanSelectNodes = false;
            packageView.BeginUpdate();
            packageView.Nodes.Clear();
            packageIcons.Images.Clear();
            var imageIndex = -1;
            if (image != null)
            {
                packageIcons.Images.Add(image);
                imageIndex = 0;
            }
            packageView.Nodes.Add(text, text, imageIndex, imageIndex);
            packageDetails.SetPackage(null);
            packageView.EndUpdate();
        }

19 Source : ScreepsAPI.cs
with MIT License
from bonzaiferroni

private void replacedignUser(JSONObject obj) {
		    User = new ScreepsUser {_id = obj["_id"].str};
		    if (OnConnectionStatusChange != null) OnConnectionStatusChange.Invoke(true);
	    }

19 Source : WebSocket.cs
with MIT License
from bonzaiferroni

private void sendAsync (Opcode opcode, Stream stream, Action<bool> completed)
    {
      Func<Opcode, Stream, bool> sender = send;
      sender.BeginInvoke (
        opcode,
        stream,
        ar => {
          try {
            var sent = sender.EndInvoke (ar);
            if (completed != null)
              completed (sent);
          }
          catch (Exception ex) {
            _logger.Fatal (ex.ToString ());
            error ("An exception has occurred while callback.");
          }
        },
        null);
    }

19 Source : WebSocket.cs
with MIT License
from bonzaiferroni

public void SendAsync (Stream stream, int length, Action<bool> completed)
    {
      var msg = _readyState.CheckIfOpen () ??
                stream.CheckIfCanRead () ??
                (length < 1 ? "'length' must be greater than 0." : null);

      if (msg != null) {
        _logger.Error (msg);
        error (msg);

        return;
      }

      stream.ReadBytesAsync (
        length,
        data => {
          var len = data.Length;
          if (len == 0) {
            msg = "A data cannot be read from 'stream'.";
            _logger.Error (msg);
            error (msg);

            return;
          }

          if (len < length)
            _logger.Warn (
              String.Format (
                "A data with 'length' cannot be read from 'stream'.\nexpected: {0} actual: {1}",
                length,
                len));

          var sent = len <= FragmentLength
                     ? send (Opcode.Binary, data)
                     : send (Opcode.Binary, new MemoryStream (data));

          if (completed != null)
            completed (sent);
        },
        ex => {
          _logger.Fatal (ex.ToString ());
          error ("An exception has occurred while sending a data.");
        });
    }

19 Source : WebSocket.cs
with MIT License
from bonzaiferroni

private void sendAsync (Opcode opcode, byte [] data, Action<bool> completed)
    {
      Func<Opcode, byte [], bool> sender = send;
      sender.BeginInvoke (
        opcode,
        data,
        ar => {
          try {
            var sent = sender.EndInvoke (ar);
            if (completed != null)
              completed (sent);
          }
          catch (Exception ex) {
            _logger.Fatal (ex.ToString ());
            error ("An exception has occurred while callback.");
          }
        },
        null);
    }

19 Source : MONO_GraphController.cs
with MIT License
from BrunoS3D

public void OnApplicationFocus(bool focus) {
#if UNITY_EDITOR
			if (!Application.isPlaying) return;
#endif
			if (DoApplicationFocus != null) {
				SetThisCurrent();
				DoApplicationFocus(focus);
			}
		}

19 Source : MONO_GraphController.cs
with MIT License
from BrunoS3D

public void OnApplicationPause(bool pause) {
#if UNITY_EDITOR
			if (!Application.isPlaying) return;
#endif
			if (DoApplicationPause != null) {
				SetThisCurrent();
				DoApplicationPause(pause);
			}
		}

19 Source : MainScreenViewModel.cs
with GNU General Public License v3.0
from bykovme

protected void ExecuteSearchLaunchCommand()
		{
			if (!IsLocalClipboardActivated) {

				SearchEntryShowHideCommandCallback.Invoke(false);
				SearchText = null;
				if (show) {
					if (searchID != null) {
						SearchEntryShowHideCommandCallback.Invoke(true);
						BL.SetCurrenreplacedemID(searchID);
						searchID = null;
					}
					sereplacedemsList(BL.GetCurrenreplacedems());
					IsSearchEnabled = false;
					show = false;
					SetHeader();
					AddButtonVisible = true;
					LaunchShowHideRestrictionCommand.Invoke(false);
					ShowEmptyAddButtonCommand.Invoke();
				} else {
					sereplacedemsList(null);
					LaunchShowHideRestrictionCommand.Invoke(true);
					IsSearchEnabled = true;
					show = true;
					HideHeader();
					AddButtonVisible = false;
					HideEmptyAddButtonCommand.Invoke();
				}

			}
		}

19 Source : MainScreenViewModel.cs
with GNU General Public License v3.0
from bykovme

void ExecuteSelectedItemCommand(object obj)
		{
			IsEdireplacedemPanel = false;
			IsEditFolderPanel = false;
			if (obj == null) return;

			if (IsSearchEnabled) {
				//SearchLaunchCommand.Execute(null);
				SearchEntryShowHideCommandCallback.Invoke(true);
				LaunchShowHideRestrictionCommand(false);
				searchID = BL.CurrenreplacedemID;
				savedSearchText = SearchText;
				IsSearchEnabled = false;
				ShowEmptyAddButtonCommand.Invoke();
				SetSearchIconCommand.Invoke(true);
			}

			var item = (NSWFormsItemModel)obj;

			if (item.ItemID == insideFolderID) {
				isInsideFolder = true;
			}

			switch (item.ItemType) {
				case ItemTypes.Folder:
					if (pasteItemID != null) {
						if (isInsideFolder) {
							IsCopyEnabled = true;
							IsMoveEnabled = false;
							setUnavailableClipboard(false);
						} else {
							IsCopyEnabled = true;
							IsMoveEnabled = true;
							setUnavailableClipboard(false);
						}
					}

					if (pasteFieldID != null) {
						IsCopyEnabled = false;
						IsMoveEnabled = false;
						setUnavailableClipboard(true, GConsts.FOLDER);
					}

					currenreplacedemType = ItemTypes.Folder;
					sereplacedemsList(BL.GetListByParentID(item.ItemID, true));
					SetHeader();
					break;
				case ItemTypes.Item:
					if (pasteItemID != null) {
						IsCopyEnabled = false;
						IsMoveEnabled = false;
						var pasteItem = BL.GereplacedemByID(pasteItemID);
						switch (pasteItem.Folder) {
							case true:
								setUnavailableClipboard(true, GConsts.FOLDER);
								break;
							case false:
								setUnavailableClipboard(true, GConsts.ITEM);
								break;
						}
					}
					currenreplacedemType = ItemTypes.Item;
					SetFieldsList(item.Fields);
					BL.SetCurrenreplacedemID(item.ItemID);
					if (pasteFieldID != null) {
						IsCopyEnabled = true;
						setUnavailableClipboard(false);
						var it = BL.GetCurrenreplacedem();
						var fields = it.Fields;
						if (fields != null) {
							var field = fields.SingleOrDefault(x => x.FieldID == pasteFieldID);
							if (field != null) {
								Device.BeginInvokeOnMainThread(() => {
									IsMoveEnabled = false;
								});
							} else {
								Device.BeginInvokeOnMainThread(() => {
									IsMoveEnabled = true;
								});
							}
						}
					}
					SetHeader();
					ItemsStatsManager.LogView(item.ItemID);
					break;
				case ItemTypes.Field:
					if (item.FieldID != null)
						BL.SetCurrentFieldID(item.FieldID);

					if (!IsLocalClipboardActivated) {

						StateHandler.CopyFieldLocallyActivated = false;
						ChangeFieldCommand.Execute(item.FieldData.HumanReadableValue);
					}
					break;
			}
			ItemToScrollTo = null;
		}

19 Source : BackupScreenViewModel.cs
with GNU General Public License v3.0
from bykovme

protected void ExecuteManualBackupCommand()
		{
			try {
				var result = BackupManager.CreateManual();

				if (result) {
					updateList();
					MessageCreateManualBackupCommand.Invoke(result);
				}
			} catch (Exception ex) {
				AppLogs.Log(ex.Message, nameof(ExecuteManualBackupCommand), nameof(BackupScreenViewModel));
			}
		}

19 Source : LicensePageViewModel.cs
with GNU General Public License v3.0
from bykovme

void ExecuteRejectCommand()
		{
			action.Invoke(false);
			navigation.PopModalAsync();
		}

19 Source : LicensePageViewModel.cs
with GNU General Public License v3.0
from bykovme

void ExecuteAcceptCommand()
		{
			action.Invoke(true);
			navigation.PopModalAsync();
		}

19 Source : MainScreenViewModel.cs
with GNU General Public License v3.0
from bykovme

protected void ExecuteSearchCommand(object obj)
		{
			if (obj != null) {
				if (!string.IsNullOrEmpty(obj.ToString())) {
					var searchPhrase = obj.ToString();
					var count = BL.CountSearchPhrase(searchPhrase);

					if (count < 3) {
						LaunchShowHideRestrictionCommand(true);
						sereplacedemsList(null, false);
					} else {
						LaunchShowHideRestrictionCommand(false);
						var nswItems = BL.Search(searchText);
						sereplacedemsList(nswItems, false);
					}
					HideEmptyAddButtonCommand.Invoke();
				}
			}
			//LaunchShowHideRestrictionCommand(true);
			//sereplacedemsList(null, false);
			//HideEmptyAddButtonCommand.Invoke();
		}

19 Source : MainScreenViewModel.cs
with GNU General Public License v3.0
from bykovme

void ExecuteBackCommand()
		{
			IsEdireplacedemPanel = false;
			IsEditFolderPanel = false;
			ItemToScrollTo = BL.CurrenreplacedemID;

			if (pasteItemID != null) {
				var currenreplacedemID = BL.CurrenreplacedemID;

				if (currenreplacedemID == insideFolderID) {
					isInsideFolder = false;
				}
				if (isInsideFolder) {
					IsCopyEnabled = true;
					IsMoveEnabled = false;
					setUnavailableClipboard(false);
				} else {
					if (currenreplacedemID == pasteItemID) {
						IsCopyEnabled = true;
						IsMoveEnabled = false;
						setUnavailableClipboard(false);
					} else {
						IsCopyEnabled = true;
						IsMoveEnabled = true;
						setUnavailableClipboard(false);
					}
				}
			}

			if (pasteFieldID != null) {
				IsCopyEnabled = false;
				IsMoveEnabled = false;
				setUnavailableClipboard(true, GConsts.FIELD);
			} else {
				setUnavailableClipboard(false);
			}

			if (searchID != null) {
				IsSearchEnabled = true;
				BL.SetCurrenreplacedemID(searchID);
				sereplacedemsList(BL.GetCurrenreplacedems());
				SearchEntryShowHideCommandCallback.Invoke(false);
				LaunchShowHideRestrictionCommand(false);
				SearchText = savedSearchText;
				SearchCommand.Execute(savedSearchText);
				searchID = null;
				HideHeader();
			} else {
				sereplacedemsList(BL.GoUpAndGetCurrenreplacedems());
				SetHeader();
			}

			currenreplacedemType = ItemTypes.Folder;
		}

19 Source : SettingsScreenViewModel.cs
with GNU General Public License v3.0
from bykovme

protected void ExecuteThemeCommand()
		{

			ThemeCommandCallback.Invoke(true);

		}

19 Source : UI+Toggles.cs
with MIT License
from cabarius

public static bool ActionToggle(
                string replacedle,
                Func<bool> get,
                Action<bool> set,
                float width = 0,
                params GUILayoutOption[] options) {
            var value = get();
            if (TogglePrivate(replacedle, ref value, false, false, width, options)) {
                set(value);
            }
            return value;
        }

19 Source : UI+Toggles.cs
with MIT License
from cabarius

public static bool ActionToggle(
                string replacedle,
                Func<bool> get,
                Action<bool> set,
                Func<bool> isEmpty,
                float width = 0,
                params GUILayoutOption[] options) {
            var value = get();
            var empty = isEmpty();
            if (TogglePrivate(replacedle, ref value, empty, false, width, options)) {
                if (!empty)
                    set(value);
            }
            return value;
        }

19 Source : UI+Toggles.cs
with MIT License
from cabarius

public static bool ToggleCallback(
                string replacedle,
                ref bool value,
                Action<bool> callback,
                float width = 0,
                params GUILayoutOption[] options) {
            var result = TogglePrivate(replacedle, ref value, false, false, width, options);
            if (result) {
                callback(value);
            }

            return result;
        }

19 Source : AudioTimeSyncController.cs
with GNU General Public License v2.0
from Caeden117

public void TogglePlaying()
    {
        if (StopScheduled)
        {
            StopCoroutine(nameof(StopPlayingDelayed));
            StopScheduled = false;
        }

        IsPlaying = !IsPlaying;
        if (IsPlaying)
        {
            if (CurrentSeconds >= SongAudioSource.clip.length - 0.1f)
            {
                Debug.LogError(":hyperPepega: :mega: STOP TRYING TO PLAY THE SONG AT THE VERY END");
                IsPlaying = false;
                return;
            }

            playStartTime = CurrentSeconds;
            SongAudioSource.time = CurrentSeconds;
            SongAudioSource.Play();

            audioLatencyCompensationSeconds = Settings.Instance.AudioLatencyCompensation / 1000f;
            CurrentSeconds -= audioLatencyCompensationSeconds;
        }
        else
        {
            SongAudioSource.Stop();
            SnapToGrid();
        }

        PlayToggle?.Invoke(IsPlaying);
    }

19 Source : BaseManager.cs
with MIT License
from ccgould

internal void ToggleBreaker()
        {
            if (HasAntenna(true))
            {
                SendBaseMessage(_hasBreakerTripped);
            }

            _hasBreakerTripped = !_hasBreakerTripped;

            OnBreakerToggled?.Invoke(_hasBreakerTripped);
        }

19 Source : InterfaceButton.cs
with MIT License
from ccgould

public override void OnPointerEnter(PointerEventData eventData)
        {
            if (_isSelected) return;
            base.OnPointerEnter(eventData);
            UpdateTextComponent(IsTextMode());
            OnInterfaceButton?.Invoke(true);
            if (this.IsHovered)
            {
                switch (this.ButtonMode)
                {
                    case InterfaceButtonMode.TextScale:
                        if (TextComponent == null) return;
                        this.TextComponent.fontSize = this.LargeFont;
                        break;
                    case InterfaceButtonMode.TextColor:
                        if (TextComponent == null) return;
                        this.TextComponent.color = this.HOVER_COLOR;
                        break;
                    case InterfaceButtonMode.Background:
                        if (_bgImage != null)
                        {
                            _bgImage.color = this.HOVER_COLOR;
                        }
                        break;
                    case InterfaceButtonMode.BackgroundScale:
                        if (this.gameObject != null)
                        {
                            this.gameObject.transform.localScale +=
                                new Vector3(this.IncreaseButtonBy, this.IncreaseButtonBy, this.IncreaseButtonBy);
                        }
                        break;
                }
            }
        }

19 Source : InterfaceButton.cs
with MIT License
from ccgould

public override void OnPointerExit(PointerEventData eventData)
        {
            if (_isSelected) return;

            base.OnPointerExit(eventData);
            UpdateTextComponent(IsTextMode());
            OnInterfaceButton?.Invoke(false);

            switch (this.ButtonMode)
            {
                case InterfaceButtonMode.TextScale:
                    if (TextComponent == null) return;
                    this.TextComponent.fontSize = this.SmallFont;
                    break;
                case InterfaceButtonMode.TextColor:
                    if (TextComponent == null) return;
                    this.TextComponent.color = this.STARTING_COLOR;
                    break;
                case InterfaceButtonMode.Background:
                    if (_bgImage != null)
                    {
                        _bgImage.color = this.STARTING_COLOR;
                    }
                    break;
                case InterfaceButtonMode.BackgroundScale:
                    if (this.gameObject != null)
                    {
                        this.gameObject.transform.localScale -=
                            new Vector3(this.IncreaseButtonBy, this.IncreaseButtonBy, this.IncreaseButtonBy);
                    }
                    break;
            }
        }

19 Source : PaginatorButton.cs
with MIT License
from ccgould

public override void OnPointerEnter(PointerEventData eventData)
        {
            base.OnPointerEnter(eventData);
            if (IsHovered)
            {
                image.color = HOVER_COLOR;
                OnInterfaceButton?.Invoke(true);
            }
        }

See More Examples