问题描述
借助此question,我能够进行自定义操作,以动态地临时更新和修改MSI数据库。
简而言之,我正在做
#========================================= Part A Without Labels ===============================================
# Libraries
library(ggraph)
library(igraph)
library(tidyverse)
library(RColorBrewer)
# create a data frame giving the hierarchical structure of your individuals
set.seed(1234)
d1 <- data.frame(from="origin",to=paste("group",seq(1,10),sep=""))
d2 <- data.frame(from=rep(d1$to,each=10),to=paste("subgroup",100),sep="_"))
edges <- rbind(d1,d2)
# create a dataframe with connection between leaves (individuals)
all_leaves <- paste("subgroup",sep="_")
connect <- rbind(
data.frame( from=sample(all_leaves,100,replace=T),to=sample(all_leaves,replace=T)),data.frame( from=sample(head(all_leaves),30,to=sample( tail(all_leaves),data.frame( from=sample(all_leaves[25:30],to=sample( all_leaves[55:60],data.frame( from=sample(all_leaves[75:80],replace=T)) )
connect$value <- runif(nrow(connect))
# create a vertices data.frame. One line per object of our hierarchy
vertices <- data.frame(
name = unique(c(as.character(edges$from),as.character(edges$to))),value = runif(111)
)
# Let's add a column with the group of each name. It will be useful later to color points
vertices$group <- edges$from[ match( vertices$name,edges$to ) ]
#======================================= Part B Create with Labels ===============================================
#Let's add information concerning the label we are going to add: angle,horizontal adjustement and potential flip
#calculate the ANGLE of the labels
vertices$id <- NA
myleaves <- which(is.na( match(vertices$name,edges$from) ))
nleaves <- length(myleaves)
vertices$id[myleaves] <- seq(1:nleaves)
vertices$angle <- 90 - 360 * vertices$id / nleaves
# calculate the alignment of labels: right or left
# If I am on the left part of the plot,my labels have currently an angle < -90
vertices$hjust <- ifelse(vertices$angle < -90,1,0)
# flip angle BY to make them readable
vertices$angle <- ifelse(vertices$angle < -90,vertices$angle+180,vertices$angle)
#====================================== Part C Plot the Labels ==================================================
# Create a graph object
mygraph <- igraph::graph_from_data_frame( edges,vertices=vertices )
# The connection object must refer to the ids of the leaves:
from <- match( connect$from,vertices$name)
to <- match( connect$to,vertices$name)
x11()
# Basic usual argument
ggraph(mygraph,layout = 'dendrogram',circular = TRUE) +
geom_node_point(aes(filter = leaf,x = x*1.05,y=y*1.05)) +
geom_conn_bundle(data = get_con(from = from,to = to),alpha=0.2,colour="skyblue",width=0.9) +
geom_node_text(aes(x = x*1.2,y=y*1.2,filter = leaf,label=name,angle = angle,hjust=hjust),size=2,alpha=1) +
theme_void() +
theme(
legend.position="none",plot.margin=unit(c(0,0),"cm"),) +
expand_limits(x = c(-1.2,1.2),y = c(-1.2,1.2))
并且我的控件的默认状态为
[CustomAction]
public static ActionResult VerifyLog(Session session)
{
var sRtfText = @"{\rtf1\ansi\deff0{\colortbl;\red0\green0\blue0;\red255\green0\blue0;}THIS IS NOT DEFAULT TEXT}";
var view = session.Database.OpenView("SELECT * FROM Control WHERE
Dialog_='EndDlg' AND Control='Verification'");
view.Execute();
var record = view.Fetch();
view.Delete(record);
record.SetString("Text",sRtfText);
view.InsertTemporary(record); // also tried original post's view.Modify(ViewModifyMode.InsertTemporary,record); as well
return ActionResult.Success;
}
我的CustomAction元素正在关注。
<Dialog Id="EndDlg" Width="600" Height="400" Title="$(var.PRODUCT_NAME)">
<Control Id="Verification" Type="ScrollableText" X="180" Y="80" Width="410" Height="280" Sunken="yes" TabSkip="no" Text="{\rtf1\ansi\deff0{\colortbl;\red0\green0\blue0;\red255\green0\blue0;}default text\line}"/>
<!-- Buttons for Navigation... -->
</Dialog>
我的InstallExecuteSequence正在关注。
<CustomAction Id="CA_01_Verify"
BinaryKey="WiXCustomAction"
DllEntry="VerifyLog"
Execute="immediate"
Return="check"/>
但是,在通过 <InstallExecuteSequence>
<Custom Action="CA_01_Verify" Before="Costinitialize"></Custom>
</InstallExecuteSequence>
退出时打开“结束对话框”时,更新后的文本消失了,控件仅显示默认文本。
当我检查文本列时,在自定义操作中,我可以看到它已正确更新。 (我在通过CA进行修改之前先进行了检查,以确保默认WAS在那里并且已更新)。
为此,我进行了另一个自定义操作,仅检查EndDlg验证控件中的“文本”条目,然后确认“验证控件”的“文本”列已正确更新。
如果它在表中正确更新,为什么在UI上没有更新?
仅作为参考,以下是结果日志
<Show Dialog="EndDlg" OnExit="success"/>
解决方法
这里有一个登录到github.com的模拟示例: https://github.com/glytzhkof/WiXViewLogExperiment
此示例以自定义设置 ExitDialog
(称为 MyExitDialog
)中生成的对话框为特色,该对话框显示了RTF文件的内容。请用您自己的RTF文件替换磁盘上的“ TestFile.rtf”,然后编译并运行生成的MSI来检查其工作原理。
打开MSI日志 :这里还有另一个示例,介绍如何从最后一个MSI对话框中打开MSI日志:https://github.com/glytzhkof/WiXOpenLogFile(在没有理解要求的情况下首先创建正确-但一直想要此功能-尚未完成,而是功能演示)。
((如果未创建任何MSI日志,则具有隐藏打开日志复选框的功能-使用 Enable Global MSI Logging.reg
文件为所有MSI操作启用MSI日志记录。显示日志)在 TEMP
文件夹中使用随机名称。)
链接部分:
WiX GUI 既是MSI文件中嵌入式的 MSI GUI,也是可以使用以下命令创建的 Burn setup.exe启动器GUI许多不同的现代技术。因此,MSI GUI与setup.exe GUI。
WiX GUI上的某些选定链接: