コード例 #1
0
        void FillList()
        {
            Func <IAsyncResult> begin = () =>
            {
                var client = MySectorServiceClient.GetCheckedInstance();
                return(client.BeginLoadTemplateCheckpointNames(null, client));
            };

            Action <IAsyncResult, MyGuiScreenProgressAsync> end = (result, screen) =>
            {
                try
                {
                    var client = (MySectorServiceClient)result.AsyncState;
                    var info   = client.EndLoadTemplateCheckpointNames(result);
                    InsertItems(info);
                }
                catch (Exception)
                {
                    MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, MyTextsWrapperEnum.PleaseTryAgain, MyTextsWrapperEnum.MessageBoxNetworkErrorCaption, MyTextsWrapperEnum.Ok, null));
                }
                screen.CloseScreenNow();
            };

            var progress = new MyGuiScreenProgressAsync(MyTextsWrapperEnum.LoadSectorIdentifiersPleaseWait, false, begin, end);

            MyGuiManager.AddScreen(progress);
        }
コード例 #2
0
        void RenameTemplate(string oldName, string newName, MyGuiScreenBase renameScreen)
        {
            renameScreen.CloseScreenNow();

            Func <IAsyncResult> begin = () =>
            {
                var client = MySectorServiceClient.GetCheckedInstance();
                return(client.BeginRenameTemplateCheckpoint(oldName, newName, null, client));
            };

            Action <IAsyncResult, MyGuiScreenProgressAsync> end = (result, screen) =>
            {
                try
                {
                    var client = (MySectorServiceClient)result.AsyncState;
                    client.EndRenameTemplateCheckpoint(result);
                }
                catch (FaultException <MyCheckpointRenameFault> e)
                {
                    switch (e.Detail.Reason)
                    {
                    case MyCheckpointRenameFaultReason.CheckpointNotFound:
                        MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, MyTextsWrapperEnum.SectorNotFound, MyTextsWrapperEnum.MessageBoxTimeoutCaption, MyTextsWrapperEnum.Ok, null));
                        break;

                    case MyCheckpointRenameFaultReason.NameAlreadyExists:
                        MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, MyTextsWrapperEnum.CantSaveSectorNameExists, MyTextsWrapperEnum.MessageBoxTimeoutCaption, MyTextsWrapperEnum.Ok, null));
                        break;
                    }
                }
                catch (Exception)
                {
                    MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, MyTextsWrapperEnum.PleaseTryAgain, MyTextsWrapperEnum.MessageBoxNetworkErrorCaption, MyTextsWrapperEnum.Ok, null));
                }
                screen.CloseScreenNow();
                FillList();
            };

            var progress = new MyGuiScreenProgressAsync(MyTextsWrapperEnum.LoadSectorIdentifiersPleaseWait, false, begin, end);

            MyGuiManager.AddScreen(progress);
        }
コード例 #3
0
        void FillList()
        {
            Func<IAsyncResult> begin = () =>
            {
                var client = MySectorServiceClient.GetCheckedInstance();
                return client.BeginLoadTemplateCheckpointNames(null, client);
            };

            Action<IAsyncResult, MyGuiScreenProgressAsync> end = (result, screen) =>
            {
                try
                {
                    var client = (MySectorServiceClient)result.AsyncState;
                    var info = client.EndLoadTemplateCheckpointNames(result);
                    InsertItems(info);
                }
                catch (Exception)
                {
                    MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, MyTextsWrapperEnum.PleaseTryAgain, MyTextsWrapperEnum.MessageBoxNetworkErrorCaption, MyTextsWrapperEnum.Ok, null));
                }
                screen.CloseScreenNow();
            };

            var progress = new MyGuiScreenProgressAsync(MyTextsWrapperEnum.LoadSectorIdentifiersPleaseWait, false, begin, end);
            MyGuiManager.AddScreen(progress);
        }
コード例 #4
0
        void RenameTemplate(string oldName, string newName, MyGuiScreenBase renameScreen)
        {
            renameScreen.CloseScreenNow();

            Func<IAsyncResult> begin = () =>
            {
                var client = MySectorServiceClient.GetCheckedInstance();
                return client.BeginRenameTemplateCheckpoint(oldName, newName, null, client);
            };

            Action<IAsyncResult, MyGuiScreenProgressAsync> end = (result, screen) =>
            {
                try
                {
                    var client = (MySectorServiceClient)result.AsyncState;
                    client.EndRenameTemplateCheckpoint(result);
                }
                catch (FaultException<MyCheckpointRenameFault> e)
                {
                    switch (e.Detail.Reason)
                    {
                        case MyCheckpointRenameFaultReason.CheckpointNotFound:
                            MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, MyTextsWrapperEnum.SectorNotFound, MyTextsWrapperEnum.MessageBoxTimeoutCaption, MyTextsWrapperEnum.Ok, null));
                            break;

                        case MyCheckpointRenameFaultReason.NameAlreadyExists:
                            MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, MyTextsWrapperEnum.CantSaveSectorNameExists, MyTextsWrapperEnum.MessageBoxTimeoutCaption, MyTextsWrapperEnum.Ok, null));
                            break;
                    }
                }
                catch (Exception)
                {
                    MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, MyTextsWrapperEnum.PleaseTryAgain, MyTextsWrapperEnum.MessageBoxNetworkErrorCaption, MyTextsWrapperEnum.Ok, null));
                }
                screen.CloseScreenNow();
                FillList();
            };

            var progress = new MyGuiScreenProgressAsync(MyTextsWrapperEnum.LoadSectorIdentifiersPleaseWait, false, begin, end);
            MyGuiManager.AddScreen(progress);            
        }