private void DoLogin(string password) { lblState.Text = "Is validating the user info......"; btnLogin.Enabled = false; txtUserNameLogin.Enabled = false; txtPasswordLogin.Enabled = false; if (password.Trim() == "") { password = "******"; } sign.Controller.UserManager.Login(txtUserNameLogin.Text.Trim(), password, p => { if (p.IsSuccessed) { LocalMessageBus.Send(sign, new LoginSuccessMessage()); ActionHelper.OnAfterLogin(sign.Controller.Connection.User); Close(); } else { OnLoginFailed(p.Packet); lblState.Text = ""; btnLogin.Enabled = true; txtUserNameLogin.Enabled = true; txtPasswordLogin.Enabled = true; } }); }
private static void SetMenuState(bool canUndo, bool canRedo) { LocalMessageBus.Send(null, new MenuMessage(new MenuCommand[] { new MenuCommand(MenuCommands.Undo, canUndo) , new MenuCommand(MenuCommands.Redo, canRedo) })); }
/// <summary> /// Mouse right menu:Import /// </summary> public void OnImport() { string[] files = null; using (OpenFileDialog dlg = new OpenFileDialog()) { dlg.Filter = _filter; //Constance.FileFilter.ImportExport; dlg.Title = "Import library files"; dlg.Multiselect = true; DialogResult result = dlg.ShowModalDialog(); if (result == DialogResult.OK || result == DialogResult.Yes) { files = dlg.FileNames; } else { return; } } if (files == null || files.Length < 1) { return; } foreach (string file in files) { Import(file); } LocalMessageBus.Send(this, new MenuMessage(MenuCommands.InsertMessage, LibraryGroup.Current.Messages.Count > 0)); LocalMessageBus.Send(this, new MenuMessage(MenuCommands.InsertTimeSlice, LibraryGroup.Current.TimeSliceGroups.Count > 0)); LocalMessageBus.Send(this, new MenuMessage(MenuCommands.InsertPlaylist, LibraryGroup.Current.Playlists.Count > 0)); }
private void btnApply_Click(object sender, EventArgs e) { //EditPictureConfirm confirm = new EditPictureConfirm(); //confirm.ShowModalDialog(); //if (confirm.Result == 1) // CurrentShapeImage.Image = (Image)pictureBox1.Image.Clone(); //else if (confirm.Result == 2) //{ // string name = new Guid().ToString(); // IOHelper.SaveImage((Image)pictureBox1.Image.Clone(), ImageUrl); //} //else // return; if (xtraTabControl1.SelectedTabPageIndex == 0) { _selection = new Rectangle(pointArray[0][0].X, pointArray[0][0].Y, pointArray[0][1].X - pointArray[0][0].X, pointArray[0][1].Y - pointArray[0][0].Y); Image img = pictureBox1.Image.Crop(_selection); if (img == null) { _selecting = false; return; } // Fit shape to the picturebox: pictureBox1.Image = img.Fit2PictureBox(pictureBox1); imageHandler.CurrentBitmap = (Bitmap)pictureBox1.Image.Clone(); CurrentImage = (Image)pictureBox1.Image.Clone(); return; } LocalMessageBus.Send(this, new EditImage(CurrentShapeImage)); IOHelper.SaveImage((Image)pictureBox1.Image.Clone(), ImageUrl); }
public static void EnableCopyMenu(bool enabled) { LocalMessageBus.Send(null, new MenuMessage(new MenuCommand[] { new MenuCommand(MenuCommands.Copy, enabled) , new MenuCommand(MenuCommands.Delete, enabled) })); }
public override void Perform() { string path = ""; sign.Controller.SendAsync( Commands.LiveImage, h => { if (h.IsSuccessed) { path = h.Packet.Content.GetProperty <string>("Path"); if (path != null && path != "") { string toFilePath = Constance.AppPath + sign.Name + ".xml"; sign.Controller.Connection.FtpManager.DownLoad(path, toFilePath); var status = Serialiser <StatusInfo> .Xml.Deserialise(toFilePath); if (status != null && status.Count > 0) { sign.Status = status[0].StatusValue.ToLower(); LocalMessageBus.Send(this, new SetPWLogo(sign.Status)); ControlService.DashboardTree.PopulateTree(); ControlService.DashboardTree.SetTreeFocusedNode(sign); } } } }, null); }
protected override void ModuleClosed() { base.ModuleClosed(); DataGate.Log.Debug("Playlist Module LocalMessageBus.Send Start;"); LocalMessageBus.Send(null, new MenuMessage(new MenuCommand[] { new MenuCommand { Command = MenuCommands.Insert, Visibility = ItemVisibility.Never } , new MenuCommand { Command = MenuCommands.InsertMessage, Visibility = ItemVisibility.Never } , new MenuCommand { Command = MenuCommands.InsertTimeSlice, Visibility = ItemVisibility.Never } , new MenuCommand { Command = MenuCommands.InsertPlaylist, Visibility = ItemVisibility.Never } , new MenuCommand { Command = MenuCommands.SendToLiveStorage, Enabled = false, Visibility = ItemVisibility.Never } , new MenuCommand { Command = MenuCommands.SendToSign, Enabled = false, Visibility = ItemVisibility.Never } , new MenuCommand { Command = MenuCommands.SendToScheduler, Enabled = false, Visibility = ItemVisibility.Never } })); DataGate.Log.Debug("Playlist Module LocalMessageBus.Send End;"); }
public override void Perform() { SignInfo sign = ControlService.SignCombo.Current; if (Sign != null && Sign != sign) { sign = Sign; } GoLive golive = new GoLive(); golive.Mode = 1; sign.Controller.SendAsync( Commands.GoLive, h => { int mode = h.Packet.Content.GetProperty <int>("Mode"); bool syncEnable = false; var serverLibries = sign.Controller.Connection.ServerLibraries; SessionInfo.Current = DataGate.SessionInfos[2]; var session = SessionInfo.Current; int serLibsCount = serverLibries.Count; int proLibraryCount = session.LibraryCategories.Length; if (serLibsCount != proLibraryCount) { syncEnable = true; } else if (serLibsCount > 0) { syncEnable = session.UpdateLibraryItemStatus(sign); //foreach (ServerLibraryItem library in serverLibries) //{ // foreach (ProWrite.Entity.Live.LiveCategory live in session.SessionCategories) // { // foreach (LiveMessageItem message in live.Items) // { // if (message.Name == library.Name) // { // syncEnable = false; // } // } // } //} } LocalMessageBus.Send(null, new MenuMessage(new MenuCommand[] { new MenuCommand { Command = MenuCommands.GoLive, Enabled = mode != 1 }, new MenuCommand { Command = MenuCommands.Sync, Enabled = syncEnable } })); }, golive); }
private void ImportPlaylistRename(List <MessageFileItem> listFiles, List <MessageItem> listMessages, List <TimeSliceGroupItem> listTimesliceGroups, List <PlaylistItem> listPlaylists, PlaylistItem playlistItem) { if (playlistItem == null || playlistItem.Item == null) { return; } if ((listFiles != null && listFiles.Count > 0) || (listMessages != null && listMessages.Count > 0) || (listTimesliceGroups != null && listTimesliceGroups.Count > 0) || (listPlaylists != null && listPlaylists.Count > 0) || !playlistItem.IsValid) { //Add playlistItem in listPlaylists PlaylistRenameForm frm = new PlaylistRenameForm(listFiles, listMessages, listTimesliceGroups, listPlaylists, playlistItem); frm.ShowModalDialog(); if (frm.IsRefresh) { ListFiles.AddRange(frm.Files); if (_listMessages == null) { _listMessages = new List <MessageItem>(); } _listMessages.AddRange(frm.Messages); if (_listTimeSliceGroups == null) { _listTimeSliceGroups = new List <TimeSliceGroupItem>(); } if (_listPlaylists == null) { _listPlaylists = new List <PlaylistItem>(); } _listTimeSliceGroups.AddRange(frm.TimeSliceGroups); _listPlaylists.AddRange(frm.Playlists); _isSucceed = LibraryGroup.Current.ImportPlaylist(ListFiles, _listMessages, _listTimeSliceGroups, _listPlaylists, frm.PlaylistItem, ControlService.SignCombo.Current); _name = frm.PlaylistItem.Item.Name; if (_listTimeSliceGroups != null && _listTimeSliceGroups.Count > 0) { LocalMessageBus.Send(this, new LibraryImportTimeSliceGroupMessage(null, LibraryType.TimeSliceGroup)); } } } else { if (ListFiles.Count > 0 || (_listMessages != null && _listMessages.Count > 0) || (_listTimeSliceGroups != null && _listTimeSliceGroups.Count > 0) || (_listPlaylists != null && _listPlaylists.Count > 0)) { _isSucceed = LibraryGroup.Current.ImportPlaylist(ListFiles, _listMessages, _listTimeSliceGroups, _listPlaylists, playlistItem, ControlService.SignCombo.Current); } else { _isSucceed = LibraryGroup.Current.Playlists.Add(playlistItem.Item); } _name = playlistItem.Item.Name; if (_listTimeSliceGroups != null && _listTimeSliceGroups.Count > 0) { LocalMessageBus.Send(this, new LibraryImportTimeSliceGroupMessage(null, LibraryType.TimeSliceGroup)); } //LocalMessageBus.Send(this, new LibraryImportTimeSliceGroupMessage(playlistItem.Item.Name, playlistItem.Item.Type)); } }
/// <summary> /// copy /// </summary> public void Copy() { if (CanCopy) { if (DoCopy()) { LocalMessageBus.Send(this, new MenuMessage(MenuCommands.Paste, true)); } } }
// Left button up event is passed to active tool. private void DrawArea_MouseUp(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { tools[(int)ActiveTool].OnMouseUp(this, e); } LocalMessageBus.Send(null, new SetDefaultDrawingIcon()); ActiveTool = ShapeToolType.ToolPointer; Cursor = Cursors.Default; }
/// <summary> /// 双击Current Sign当前选中的Sign, /// </summary> /// <param name="sender"></param> /// <param name="msg"></param> void DashboardTree_ObserversDoubleClick(object sender, DoubleClickCurrentImage msg) { if (msg != null) { signInsertPhoto = msg.CurrentSign; ControlService.SignImage.SignInsertPhoto = signInsertPhoto; openFileDialog.ShowModalDialog(); LocalMessageBus.Send(this, new ActiveChange(msg.CurrentSign, false)); //EditDashboardItem(new SignForm(msg.CurrentSign), msg.CurrentSign as DashboardItem); } }
private void btnOk_Click(object sender, EventArgs e) { CurrentShapeImage.Image = (Image)pictureBox1.Image.Clone(); LocalMessageBus.Send(this, new EditImage(CurrentShapeImage)); //File.Delete(ImageUrl); if (File.Exists(ImageUrl)) { IOHelper.SetFileAttribute(ImageUrl, FileAttributes.Normal); } IOHelper.SaveImage((Image)pictureBox1.Image.Clone(), ImageUrl); Close(); }
//public override string NullText //{ // get // { // return base.NullText; // } // set // { // //base.NullText = value; // //if (Editor != null) // // Editor.Refresh(); // } //} /// <summary> /// When add ,modify ,delete Sign data, refresh combo /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnSignChanged(object sender, DataChangedMessage e) { if (e.DataType == PWDataType.Dashboard) { Populate(); } LocalMessageBus.Send(this, new MenuMessage( new MenuCommand { Command = MenuCommands.Connect, Caption = "Connect", Enabled = Current != null && Current.DashboardType == DashboardType.Sign })); }
void btnThumbNailImage_Click(object sender, System.EventArgs e) { try { IOHelper.RemoveFile(_model.ImagePath); } catch { ILog _log = LogManager.GetLogger(typeof(IOHelper)); _log.Error("Remove Thumbnail Image Error."); } GenerateNailImageNoWaitCursor(); LocalMessageBus.Send(this, new PWMessage <MenuCommands>(MenuCommands.Save)); //SetCreateNailImageTime(); }
/// <summary> /// Update sign info when Connect success /// </summary> void UpdateSignInfo() { //判断是否添加新项成功 if (!_IsEdit) { if (!_Parent.AddSign(Current)) { Action successCallback = null; Action failCallback = null; var action = new LogoffAction(Current, successCallback, failCallback, false); action.Perform(); btnSave.Enabled = true; txtServerName.Enabled = true; txtConnectPWD.Enabled = true; MsgBox.Warning(Resource.GetString(Resource.Strings.DashBoard_SaveSignRepeat)); return; } } if (this.ddlSignParent.Text == SelectText) { Current.Parent = DataGate.Project.RootGroup; } else { Current.Parent = ddlSignParent.SelectedItem as SignGroupInfo; } //判断是否需要上传图片 if (btSignImage.Text.Length > 0) { //DataGate.Upload(btSignImage.Text); UpLoad(); Current.Image = Current.Template.Sign.Image = strImageFullName; } Current.IsWebCam = rdbWebCam.Checked; DataGate.Update(); this.IsRefresh = true; LocalMessageBus.Send(Current, new LoginSuccessMessage()); //ActionHelper.OnAfterLogin(Current.Controller.Connection.User); //Close(); isSaveClose = true; this.Close(); }
/// <summary> /// Function: Config library group control state /// Author : Jerry Xu /// Date : 2009-1-14 /// </summary> /// <param name="sender"></param> /// <param name="msg">LibraryGroupActionStateMessage</param> void LibraryTree_Observers(object sender, LibraryGroupActionStateMessage msg) { //Config library group control state lookUpLibraryGrp.Enabled = msg.CanEdit; //Config library group edit buttons state //for (int i = 0; i < btnEdit.Properties.Buttons.Count;i++ ) //{ // btnEdit.Properties.Buttons[i].Enabled = msg.CanEdit; //} buttonEditState = msg.CanEdit; LocalMessageBus.Send(this, new MenuMessage(MenuCommands.NewLibraryGroup, buttonEditState)); //Config library group remove button state if (lookUpLibraryGrp.Enabled) { RemoveButtonStatus(); } }
public bool Add(LibraryItem item) { bool flag = tvLibrary.Add(item); if (flag) { if (item.Type == LibraryType.TimeSliceGroup) { LibraryGroup.Current.TimeSliceGroups.Add(item); } //DataGate.SetCurrentLibraryGroup(LibraryGroup.Current.Name); } LocalMessageBus.Send(this, new MenuMessage(MenuCommands.InsertMessage, LibraryGroup.Current.Messages.Count > 0)); LocalMessageBus.Send(this, new MenuMessage(MenuCommands.InsertTimeSlice, LibraryGroup.Current.TimeSliceGroups.Count > 0)); LocalMessageBus.Send(this, new MenuMessage(MenuCommands.InsertPlaylist, LibraryGroup.Current.Playlists.Count > 0)); return(flag); }
public static void OnDisconnected(bool connectState) { LocalMessageBus.Send(null, new MenuMessage(new MenuCommand[] { new MenuCommand { Command = MenuCommands.Connect, Caption = "Connect", Enabled = connectState } , new MenuCommand { Command = MenuCommands.UserManager, Enabled = false } , new MenuCommand { Command = MenuCommands.Dimming, Enabled = false } , new MenuCommand { Command = MenuCommands.TempOffset, Enabled = false } , new MenuCommand { Command = MenuCommands.ResetTime, Enabled = false } , new MenuCommand { Command = MenuCommands.BlankSign, Caption = "Stop", Enabled = false } , new MenuCommand { Command = MenuCommands.UnBlankSign, Caption = "Play", Enabled = false } , new MenuCommand { Command = MenuCommands.TestPattern, Enabled = false } , new MenuCommand { Command = MenuCommands.RebootCXC, Enabled = false } , new MenuCommand { Command = MenuCommands.TimeZone, Enabled = false } , new MenuCommand { Command = MenuCommands.LiveImage, Enabled = false } })); if (ControlService.SignCombo.Current != null) { ControlService.SignCombo.Current.IsConnected = "DisConnected"; } ControlService.SignImage.RefreshImage(); ControlService.DashboardTree.PopulateTree(); ControlService.CurrentClip.RefreshClip(); }
protected override void ModuleClosed() { base.ModuleClosed(); DataGate.Log.Debug("Editor Module LocalMessageBus.Send Start;"); LocalMessageBus.Send(null, new MenuMessage(new MenuCommand[] { new MenuCommand { Command = MenuCommands.Insert, Visibility = ItemVisibility.Never } , new MenuCommand { Command = MenuCommands.Text, Visibility = ItemVisibility.Never } , new MenuCommand { Command = MenuCommands.Image, Visibility = ItemVisibility.Never } , new MenuCommand { Command = MenuCommands.Video, Visibility = ItemVisibility.Never } , new MenuCommand { Command = MenuCommands.DynamicText, Visibility = ItemVisibility.Never } , new MenuCommand { Command = MenuCommands.DynamicVideo, Visibility = ItemVisibility.Never } , new MenuCommand { Command = MenuCommands.Time, Visibility = ItemVisibility.Never } , new MenuCommand { Command = MenuCommands.Temperature, Visibility = ItemVisibility.Never } , new MenuCommand { Command = MenuCommands.SendToLiveStorage, Visibility = ItemVisibility.Never } , new MenuCommand { Command = MenuCommands.SendToSign, Visibility = ItemVisibility.Never } , new MenuCommand { Command = MenuCommands.SendToPlaylist, Visibility = ItemVisibility.Never } , new MenuCommand { Command = MenuCommands.SendToScheduler, Visibility = ItemVisibility.Never } })); DataGate.Log.Debug("Editor Module LocalMessageBus.Send End;"); }
public static void OnCancelConnect() { LocalMessageBus.Send(null, new MenuMessage(new MenuCommand[] { new MenuCommand { Command = MenuCommands.CancelConnect, Caption = "Cancel", Enabled = true } //,new MenuCommand{ Command = MenuCommands.UserManager,Enabled = false} // ,new MenuCommand{ Command = MenuCommands.Dimming,Enabled = false} // ,new MenuCommand{ Command = MenuCommands.TempOffset,Enabled = false} // ,new MenuCommand{ Command = MenuCommands.ResetTime,Enabled = false} // ,new MenuCommand { Command = MenuCommands.BlankSign, Enabled = false} // ,new MenuCommand { Command = MenuCommands.TestPattern, Enabled = false} // ,new MenuCommand { Command = MenuCommands.RebootCXC, Enabled = true} // ,new MenuCommand { Command = MenuCommands.TimeZone, Enabled = false} // ,new MenuCommand { Command = MenuCommands.LiveImage, Enabled = false} })); }
/// <summary> /// Login /// </summary> /// <param name="sign"></param> /// <param name="password"></param> private void DoLogin(SignInfo sign, string password) { if (password.Trim() == "") { password = "******"; } sign.Controller.UserManager.Login(sign.LoginInfomation.UserName, password, p => { if (p.IsSuccessed) { int h = sign.Height; int w = sign.Width; sign.Height = 10000; sign.Width = 10000; LocalMessageBus.Send(this, new DataChangedMessage(PWDataType.Dashboard)); LocalMessageBus.Send(this, new ActiveChange(sign, false)); sign.Height = h; sign.Width = w; PopulateTree(); treeList.FocusedNode = treeList.FindNodeByFieldValue(_.Name, sign.Name); var focusedNode = treeList.FindNodeByFieldValue(_.Name, sign.Name); if (focusedNode != null) { focusedNode.ImageIndex = _.SignConnectImageIndex; } ControlService.SignCombo.Current = sign; ActionHelper.OnAfterLogin(sign.Controller.Connection.User); if (focusedNode != null) { focusedNode.ImageIndex = _.SignConnectImageIndex; } } else { Action successCallback = null; Action failCallback = null; var action = new LogoffAction(sign, successCallback, failCallback, false); action.Perform(); OnLoginFailed(p.Packet); } }); Cursor = Cursors.Default; }
public static void OnAfterLogin(User user) { bool enableCommand = user.IsCommandRole; LocalMessageBus.Send(null, new MenuMessage(new MenuCommand[] { new MenuCommand { Command = MenuCommands.DisConnect, Caption = "Disconnect", Enabled = true } , new MenuCommand { Command = MenuCommands.UserManager, Enabled = true } , new MenuCommand { Command = MenuCommands.Dimming, Enabled = enableCommand } , new MenuCommand { Command = MenuCommands.TempOffset, Enabled = enableCommand } , new MenuCommand { Command = MenuCommands.ResetTime, Enabled = enableCommand } , new MenuCommand { Command = MenuCommands.BlankSign, Caption = "Stop", Enabled = enableCommand } , new MenuCommand { Command = MenuCommands.UnBlankSign, Caption = "Play", Enabled = enableCommand } , new MenuCommand { Command = MenuCommands.TestPattern, Enabled = enableCommand } , new MenuCommand { Command = MenuCommands.RebootCXC, Enabled = enableCommand } , new MenuCommand { Command = MenuCommands.TimeZone, Enabled = enableCommand } , new MenuCommand { Command = MenuCommands.LiveImage, Enabled = enableCommand } })); OnBlankSign(); }
protected override void ModuleShown() { base.ModuleShown(); ControlService.LibraryTree.Controller.Type = LibraryGroup.SchedulerFilter; ChangeState(); LocalMessageBus.Send(this, new MenuMessage(MenuCommands.Open, (LibraryGroup.Current.Messages.Count > 0 && ModelType == LibraryType.Message) || (LibraryGroup.Current.Playlists.Count > 0 && ModelType == LibraryType.Playlist) || (LibraryGroup.Current.Schedulers.Count > 0 && ModelType == LibraryType.Schedule))); bool insertEnabled = TabControl.Current != null; //bool isSaved = TabControl.Current != null // && TabControl.Current.Model != null // && ControlService.LibraryTree.Controller.GetNode(TabControl.Current.Model) != null; //LocalMessageBus.Send(null, new MenuMessage(new MenuCommand[]{ // new MenuCommand{ Command= MenuCommands.Insert, Enabled = insertEnabled, Visibility = ItemVisibility.Always} // , new MenuCommand{ Command= MenuCommands.InsertMessage, Enabled = insertEnabled, Visibility = ItemVisibility.Always} // , new MenuCommand{Command= MenuCommands.InsertTimeSlice, Enabled = insertEnabled, Visibility = ItemVisibility.Always} // , new MenuCommand{Command= MenuCommands.InsertPlaylist, Enabled = insertEnabled, Visibility = ItemVisibility.Always} // , new MenuCommand{Command= MenuCommands.SendToSign, Enabled = insertEnabled // && ControlService.SignCombo.Current.Controller.Connection.User.Status == UserStatus.Online // &&!ScheduleControl.Current.ChangedService.HasChanged // &&isSaved, Visibility = ItemVisibility.Always} // , new MenuCommand{Command= MenuCommands.SendToLiveStorage, Enabled = false, Visibility = ItemVisibility.Always} // })); }
protected override void ModuleClosed() { base.ModuleClosed(); LocalMessageBus.Send(null, new MenuMessage(new MenuCommand[] { new MenuCommand { Command = MenuCommands.Insert, Visibility = ItemVisibility.Never } , new MenuCommand { Command = MenuCommands.InsertMessage, Visibility = ItemVisibility.Never } , new MenuCommand { Command = MenuCommands.InsertTimeSlice, Visibility = ItemVisibility.Never } , new MenuCommand { Command = MenuCommands.InsertPlaylist, Visibility = ItemVisibility.Never } , new MenuCommand { Command = MenuCommands.SendToLiveStorage, Visibility = ItemVisibility.Never } })); }
public new bool Remove(ShapeBase shape) { if (shape == null) { return(false); } if (shape.Type == ShapeType.ShapeDraw) { bool flg = true; foreach (ShapeBase item in _shapeDraw.Childs) { if (!Remove(item)) { flg = false; } } return(flg); } int index = shape.Index; RemoveEvent(shape); if (Contains(shape)) { _changedService.MarkChanged(); if (shape.LayerType == LayerType.Paint) { _shapeDraw.DeleteChildShape(shape); } bool flag = base.Remove(shape); LocalMessageBus.Send(this, new MenuMessage(new MenuCommand(MenuCommands.Delete, SelectedShape != null))); Document_AddRemoveShape(this, new AddRemoveShapeEventArgs(shape, AddRemoveShapeEventArgs.EventType.Delete, index)); return(flag); } return(false); }
private void ImportTimeSliceGroupRename(List <MessageFileItem> listFiles, List <MessageItem> listMessages, TimeSliceGroupItem groupItem) { if (groupItem == null || groupItem.Item == null) { return; } if ((listFiles != null && listFiles.Count > 0) || (listMessages != null && listMessages.Count > 0) || !groupItem.IsValid) { TimeSlieceGroupRenameForm frm = new TimeSlieceGroupRenameForm(listFiles, listMessages, groupItem); frm.ShowModalDialog(); if (frm.IsRefresh) { ListFiles.AddRange(frm.Files); if (_listMessages == null) { _listMessages = new List <MessageItem>(); } _listMessages.AddRange(frm.Messages); _isSucceed = LibraryGroup.Current.ImportTimeSliceGroup(ListFiles, _listMessages, frm.Group.Item, ControlService.SignCombo.Current); _name = frm.Group.Item.Name; LocalMessageBus.Send(this, new LibraryImportTimeSliceGroupMessage(frm.Group.Item.Name, frm.Group.Item.Type)); } } else { if ((ListFiles.Count > 0) || (_listMessages != null && _listMessages.Count > 0)) { _isSucceed = LibraryGroup.Current.ImportTimeSliceGroup(ListFiles, _listMessages, groupItem.Item, ControlService.SignCombo.Current); } else { _isSucceed = LibraryGroup.Current.TimeSliceGroups.Add(groupItem.Item); } _name = groupItem.Item.Name; LocalMessageBus.Send(this, new LibraryImportTimeSliceGroupMessage(groupItem.Item.Name, groupItem.Item.Type)); } }
public override void Perform() { SignInfo sign = ControlService.SignCombo.Current; if (Sign != null && Sign != sign) { sign = Sign; } sign.Controller.SendAsync( Commands.GetLiveState, h => { if (h.IsSuccessed) { int i = h.Packet.Content.GetProperty <int>("Mode"); LocalMessageBus.Send(null, new MenuMessage(new MenuCommand[] { new MenuCommand { Command = MenuCommands.GoLive, Enabled = i != 1 } })); } }, null); }
void btnOK_Click(object sender, EventArgs e) { SelectedItems = tree.SelectedItems; if (SelectedItems == null || SelectedItems.Length < 1) { MsgBox.Error("Please select library in the list."); return; } if (isOpenLibrary) { SelectedItems[0].IsOpen = true; bool canOpen = CommonHelper.IsShowOpenDialog(SelectedItems[0].Type); LocalMessageBus.Send(null, new MenuMessage(new MenuCommand[] { new MenuCommand { Command = MenuCommands.Open, Enabled = canOpen } })); } DialogResult = DialogResult.OK; Close(); }
public override MemoryLibraryItem OnImportOpen(string fileName) { ImportFile(fileName); LocalMessageBus.Send(null, new MenuMessage(new MenuCommand[] { new MenuCommand { Command = MenuCommands.InsertMessage, Enabled = LibraryGroup.Current.Messages.Count > 0 } , new MenuCommand { Command = MenuCommands.InsertTimeSlice, Enabled = LibraryGroup.Current.TimeSliceGroups.Count > 0 } , new MenuCommand { Command = MenuCommands.InsertPlaylist, Enabled = LibraryGroup.Current.Playlists.Count > 0 } })); if (_isSucceed && !string.IsNullOrEmpty(_name)) { return(LibraryGroup.Current.Playlists.GetByName(_name)); } //else // MsgBox.Error(Resource.GetFormatString(Resource.Strings.LibraryOpenFailure, new object[] { LibraryType.Playlist.ToString(), Path.GetFileNameWithoutExtension(fileName) })); return(null); }